-
Notifications
You must be signed in to change notification settings - Fork 0
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
Create TypeScript type definitions for phet-lib #3
Comments
We added d.ts output in phetsims/chipper#1424, next we need a way to bundle/include it with phet-lib. |
I've got the holy grail of an NPM package set up in testing (scenery-stack-test). Using phetsims/phet-vite-demo@03eb961 (the scenery-stack-test branch of phet-vite-demo), I have a much more standard setup running: It's type-safe (using TSC output for JS, d.ts, d.ts.map, and js.map), supports all of our common code, and seems to be working very swimmingly! Example imports in a library: https://github.com/phetsims/phet-vite-demo/blob/scenery-stack-test/src/main.ts#L8-L16. It is type safe, and uses declaration/source maps so the development experience is up to par. It also shows promise for how we might be able to link our dependencies easily in package.json (instead of awkwardly in sherpa, with type definition hackery): https://github.com/phetsims/scenery-stack-test/blob/main/package.json#L100-L115. I'm able to easily wrap those to provide globals (https://github.com/phetsims/scenery-stack-test/blob/main/src/minimal-preload.ts#L4-L33). Current build approach is brittle. Figuring out "what translated strings do we include, and do we include translations" will be an interesting problem/question. It is NOT tree-shakeable right now. |
…id circular reference issue, see phetsims/phet-lib#3
…id circular reference issue, see phetsims/phet-lib#3
…id circular reference issue, see phetsims/phet-lib#3
This has been completed for the scope of this issue, closing! |
This would be helpful/necessary to really work with phet-lib in TypeScript. Ideally we'd build the type definitions along-side the JS code.
The text was updated successfully, but these errors were encountered: