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

2.0: Add Typescript type exporting #6972

Open
wants to merge 47 commits into
base: dev-2.0
Choose a base branch
from

Conversation

davepagurek
Copy link
Contributor

@davepagurek davepagurek commented Apr 14, 2024

This is based off of #6777, so you can see just the new Typescript bits here: https://github.com/davepagurek/p5.js/compare/initial-conversion-script..tsc

So it adds an npm run types command which generates, currently, types/p5.rollup.esm.d.ts. The reason for the name is that:

  • Typescript does not work on our regular source files since we add to the same prototype across multiple files, and this does not seem to be something Typescript supports. However, the prototype syntax isn't bad on its own, so our rollup files are ok!
  • Typescript doesn't seem to export anything if there aren't any exports, so lib/p5.rollup.js doesn't output any types, but lib/p5.rollup.esm.js does.

@davepagurek
Copy link
Contributor Author

TODO: make a thing to generate global mode types

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

2 participants