Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: bundled types are not resolving properly #191

Open
amk-dev opened this issue Dec 27, 2024 · 5 comments
Open

bug: bundled types are not resolving properly #191

amk-dev opened this issue Dec 27, 2024 · 5 comments

Comments

@amk-dev
Copy link
Contributor

amk-dev commented Dec 27, 2024

How to reproduce

  1. Get a fresh installation of shortest &
  2. See if in the shortest.config.ts, ShortestConfig resolves properly
shortest-types-bug.mp4
@amk-dev
Copy link
Contributor Author

amk-dev commented Dec 27, 2024

working on a fix fox this.

do you guys care about common js support, or just esm works ? ( ESM only would make the setup + everything very simple imo )

i'm using are-types-wrong to evalute the types

https://arethetypeswrong.github.io/?p=%40antiwork%2Fshortest%400.1.1

@m2rads
Copy link
Contributor

m2rads commented Dec 27, 2024

There is definitely room for improving the types when bundling. One challenge we ran into early on was generating the index.d.ts file with typescript. Right now we are doing it in a hacky way by implementing that file manually. I think the fix would be to generate type along with the build command.

@amk-dev
Copy link
Contributor Author

amk-dev commented Dec 27, 2024

this is not from a feature branch.
this is from @antiwork/shortest@0.1.1 published on npm.

image

as you can see the ShortestConfig is not resolving

updating the paths to this should fix it

import type { ShortestConfig } from "dist/types/types/config";
import type { TestAPI, TestContext } from "dist/types/types/test";

@amk-dev
Copy link
Contributor Author

amk-dev commented Dec 27, 2024

One challenge we ran into early on was generating the index.d.ts file with typescript. Right now we are doing it in a hacky way by implementing that file manually.

What is the public api, knowing that should help me fix it

but if you want a quick fix without going there, updating the path as mentioned above should work, since the ShortestConfig is an important type imo.

@m2rads
Copy link
Contributor

m2rads commented Dec 27, 2024

So the public API is this: index.ts in the root of packages/shortest dir. index.d.ts should be created automatically by typescript automatically but we are actually writing it manually. So I think that is the main issue we are dealing with. I am open to ideas on how to fix it or if you think we need to address this issue from somewhere else let me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants