Closed MysteryBlokHed closed 1 week ago
Name | Link |
---|---|
Latest commit | effc25f16c088db710079c0414a9e82b628cdcc4 |
Latest deploy log | https://app.netlify.com/sites/colorjs/deploys/666dc85b7d7acd0008d41d36 |
Deploy Preview | https://deploy-preview-555--colorjs.netlify.app |
Preview on mobile | Toggle QR Code...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify site configuration.
I tried using this branch on my project but ran into some compilation errors.
It looks like the typescript compiler can't find the types. Do I need to change something in my typescript project to see the types?
Hm. I'll take a look in a few minutes, but it should just be using the JSDoc types of that file automatically. Maybe try adding "allowJs": true
and/or "checkJs": true
to your own tsconfig?
Hm. I'll take a look in a few minutes, but it should just be using the JSDoc types of that file automatically. Maybe try adding
"allowJs": true
and/or"checkJs": true
to your own tsconfig?
If this works, then it might be worth using .d.ts
again to avoid forcing TS consumers to do this. If I understand correctly, it should be possible to generate .d.ts
files while using JSDoc types, so we can still keep the docs with the code as we wanted.
Hm. I'll take a look in a few minutes, but it should just be using the JSDoc types of that file automatically. Maybe try adding
"allowJs": true
and/or"checkJs": true
to your own tsconfig?
Tried adding each one individually and both together and had the same problem.
Did this happen for earlier commits on main
? If so, then I have an idea:
The project's typing tests can resolve that path, which I think comes from the fact that this configuration only exists in the project's tsconfig:
"paths": {
"colorjs.io": ["../src"],
"colorjs.io/fn": ["../src/index-fn.js"],
"colorjs.io/*": ["../*"]
}
I'm not sure whether there's a good way to reflect this in the package.json. Would you mind checking whether the problem exists on v0.5.0
(before the types were moved to JSDoc)? Maybe adding back some of the removed fields from the package.json would be enough.
If that's it, then I can open a separate PR to try and fix it.
Did this happen for earlier commits on
main
? If so, then I have an idea:The project's typing tests can resolve that path, which I think comes from the fact that this configuration only exists in the project's tsconfig:
"paths": { "colorjs.io": ["../src"], "colorjs.io/fn": ["../src/index-fn.js"], "colorjs.io/*": ["../*"] }
I'm not sure whether there's a good way to reflect this in the package.json. Would you mind checking whether the problem exists on
v0.5.0
(before the types were moved to JSDoc)? Maybe adding back some of the removed fields from the package.json would be enough.If that's it, then I can open a separate PR to try and fix it.
Everything worked fine up to the big jsdoc commit. I've been running again https://github.com/color-js/color.js/tree/ca7391600ee85635c25515adf0b23be9660f7e3c for the last week.
I'll play around with adding some fields to package.json to see if i can get it to work.
The only way I could get my project to compile was to add the "types" field back to package.json
"./fn": {
"import": {
"default": "./src/index-fn.js",
"types": "./src/index-fn.d.ts"
},
And then use this hacked togethjer index-fn.d.ts
file. I only added enough exports to get my project to compile so it doesn't include everything. I also had to export each module individually, export *
didn't work for some reason.
In VSCode intellisense didn't work for files with jsdoc comments.
I suspect we may have to generate .d.ts
files but I'm far from a Typescript export so maybe there's a way to get things working correctly.
I also had to change "moduleResolution"
in my tsconfig.json
from Node
to bundler
.
What does Svelte do? They use the same typing architecture, right?
I suggest we merge this since we need to deal with the breakage ASAP, and investigate how we can improve on it later.
From a glance at their npm page, it seems that Svelte does generate .d.ts
files:
So we could do the same thing for color.js to fix the issue
I suggest we merge this since we need to deal with the breakage ASAP, and investigate how we can improve on it later.
Sounds good to me
Fine by me, though we should report the issue to the TS folks in case it’s a bug.
Svelte has a script to generate types.
https://github.com/sveltejs/svelte/blob/main/packages/svelte/scripts/generate-types.js
https://github.com/sveltejs/svelte/blob/main/packages/svelte/package.json
Just opened #563 for further discussion, since it's not really related to this PR
Should we go ahead and merge this PR now, and then think about a separate one for how to generate declarations?
Closes #551 Fixes a regression caused by #540
Re-exports types that were previously exported in
index.js
andindex-fn.js
.If anyone knows a better way to re-export the
index-fn
types other than what I've done (a series of@typedef
statements), I'm open to suggestions.Also: note that the "re-exported from..." comments are currently actually incorrect—they come from the test files and indicate where the types used to be defined. I can remove or alter these comments if desired.