-
Notifications
You must be signed in to change notification settings - Fork 37
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
What about types? #115
Comments
you TS folks need to talk 😅 |
@WebReflection I see. I opened an MR #116 would mind review it? |
@eatsjobs I really don't like all that noise in the repo ... I mean, locally in my editor, is there really nothing we can do to have all types correctly resolved in a folder a part? this should also create types only once because the cjs artifact is a 1:1 representation of the esm one so one types folder from esm should satisfy both cases. |
Hey @WebReflection unfortunately not that I'm aware of. The problem are the types with dynamic import like |
nope, and not planning to ... I wish there was https://www.npmjs.com/package/rollup-plugin-jsdoc for JSDoc TS that would do whatever the dts plugin does at the end ... we can't have it all, it seams ... btw, with latest changes with exports, do you still have issues with types? talking about 4.5.1 |
https://www.npmjs.com/package/uhtml?activeTab=code cannot see the .d.ts file in the npm package. am I missed something? I don't see a "file" field in the package.json 🤔 |
Since my changes are not in main even if you merge it maybe you rebased? anyway I re-prepare the "same" MR #119 |
@eatsjobs I've reverted your change because it breaks on postbuild ... I think if I try it again it will break again and that's a no-go to me as I run build before publishing and the errors block my flow. |
@WebReflection Ok I can work on that |
@WebReflection Once you release 4.5.2 we can easily see if the types are working here https://stackblitz.com/edit/vitejs-vite-udoa4c?file=src%2Fcounter.ts |
I'd like to leave also this article here cause I think is related. https://blog.isquaredsoftware.com/2023/08/esm-modernization-lessons/ what a time to be a package maintainer! |
Types should have worked already without the .d.ts files. Did it not work for you? update: I see you mention stackblitz. I use the built-in Typescript LSP from VS Code. |
Types are broken again on v4.5.5. v4.5.2 is fine. Both Deno and To test this yourself, save the following two files as This works. If you change
This already shows a type error without modification. ("initSsr is not callable")
|
no they don't work with latest version of typescript and a vanilla-ts vite template like you can test it in stackblitz link |
btw this works with deno import initSsr from "https://cdn.jsdelivr.net/npm/uhtml@4.5.5/ssr/+esm";
const { html, render } = initSsr();
const abc = [1, 2, 3];
console.log(
html`hi, i can count to three!
${abc.map((x, i) => html`${x}${i == 2 ? "!" : ", "}`)}`
.toDOM()
.toString()
); I think is more something related on how esm.sh handle the package. is there a way with deno to install an npm package? I read about jsr. maybe can help you. but jsdeliver works just fine so give it a try |
@iacore if you want to test all possible types resolution you can do it with https://www.npmjs.com/package/@arethetypeswrong/cli which I added in last MR Support both cjs and esm is possible but tricky and honestly don't worth the effort. |
Typescript and node module resolution is cursed.
Yes. It's also broken, but in another way.
|
Thanks for telling me JSR. I'll take a look if I can publish uhtml there. @WebReflection can I do that? |
I want this infinite types story done then I will publish on JSR as I have alreday my |
I went ahead and published this #121 Can anyone please confirm |
Type resolution is correct on Deno. Type definition is somewhat incorrect.
|
@iacore how about now with |
See #122 |
|
If everything is working also for @iacore you can close the issue for me @WebReflection Thanks!! |
as per title I saw there are not types nor @types/uhtml package. am I missing something?
The text was updated successfully, but these errors were encountered: