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

Update documentation about common declaration files to include #1121

Closed
zepumph opened this issue Oct 19, 2021 · 4 comments
Closed

Update documentation about common declaration files to include #1121

zepumph opened this issue Oct 19, 2021 · 4 comments

Comments

@zepumph
Copy link
Member

zepumph commented Oct 19, 2021

While working on phetsims/ratio-and-proportion#404, I found that we have to manually add some basic items to each sim's tsconfig file in order to get the IDE to behave correctly.

There is no documentation about this. @samreid can you please add it. Specifically it seems like these files are the important ones to "include":

"../chipper/phet-types.d.ts",
    "../chipper/node_modules/@types/lodash/index.d.ts",
    "../chipper/node_modules/@types/qunit/index.d.ts"

I tried to add them to an "include" section in the top-level tsconfig-core file in chipper, and though the typescript command line compiler is fine with that, the IDE doesn't recognize it at all (every assert usage is an error).

@samreid
Copy link
Member

samreid commented Oct 26, 2021

TypeScript can only factor out *.js and *.ts files, not declaration *.d.ts files, so these will have to be listed in each repo. Since we don't have tooling for updating all these files together, I've added a note to the quick start guide as @zepumph recommended. In the future, we may need a way to automatically update these across sims. But we'll have to see how much we actually use *.d.ts files once we use TS in common code. @zepumph can you please review?

@zepumph
Copy link
Member Author

zepumph commented Oct 26, 2021

But we'll have to see how much we actually use *.d.ts files once we use TS in common code

Can you comment on what you mean by this. We are always going to use lodash in our sims, what would change when we go all in on typescript that would mean we wouldn't need to still keep the declaration file for lodash?

@zepumph
Copy link
Member Author

zepumph commented Oct 26, 2021

Commits look great! Feel free to close.

@zepumph zepumph assigned samreid and unassigned zepumph Oct 26, 2021
@samreid
Copy link
Member

samreid commented Oct 26, 2021

Can you comment on what you mean by this. We are always going to use lodash in our sims, what would change when we go all in on typescript that would mean we wouldn't need to still keep the declaration file for lodash?

If we decide to restrict to JS in common code for the foreseeable future, this could lead to a proliferation of *.d.ts files in common code, which would require a higher level of tooling & support than if we just stick with a more steady version of lodash/qunit.

Also ready to close, unless there is more to discuss.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants