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

Declare Typescript modules in IO packages #1298

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

bruceborrett
Copy link
Contributor

All Submissions:

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?
  • Does your submission pass tests?

Note: please do NOT include build files (those generate by the build-xxx commands) with your PR,

Thank you for your help in advance, much appreciated !

Copy link
Contributor

@platypii platypii left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall this seems fine. It would be helpful if you gave some additional details in the PR write up however. Questions:

  • What is this fixing?
  • How can I repro/verify the changes have made an improvement?
  • What good does it do to declare module for the IO packages if they don't actually contain any type definitions yet?
  • We have usually followed the convention of putting .d.ts files in the src directory, next to the files they provide types for. So I think it would be more consistent to move your types/index.d.ts files to src/index.d.ts and update package.json accordingly. Is there a benefit to having the types in their own types directory?

@bruceborrett
Copy link
Contributor Author

Sorry for the lack of information in this PR.

The issue I was having was when I tried to import an IO package in my project I would get the following error:

Could not find a declaration file for module '@jscad/stl-serializer'. Try npm i --save-dev @types/jscad__stl-serializer if it exists or add a new declaration (.d.ts) file containing declare module '@jscad/stl-serializer';

Simply adding the module declaration resolved the error, Im not sure if this is the best way to solve this but may be a good enough interim solution until proper Typescript support is added?

I added a seperate types directory as I noticed that is the way it was done in the regl-renderer package, did not check the other packages, I can move it to src/index.d.ts if you prefer?

@z3dev
Copy link
Member

z3dev commented Oct 19, 2023

Simply adding the module declaration resolved the error, Im not sure if this is the best way to solve this but may be a good enough interim solution until proper Typescript support is added.

After adding this interim solution, was there any typing available for the deserialize / serialize functions? Were you able to use the exports of the IO packages?

@z3dev
Copy link
Member

z3dev commented Dec 4, 2023

@bruceborrett sorry. that was a question for you. Were you able to import and use the IO libraries after these definitions were added?

Also, please move the type definitions into src/index.d.ts

@z3dev
Copy link
Member

z3dev commented May 14, 2024

@bruceborrett Sorry. Can you move the changes to src/index.d.ts ?

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

Successfully merging this pull request may close these issues.

None yet

3 participants