-
Notifications
You must be signed in to change notification settings - Fork 14
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
Generate d.ts files #1424
Comments
Notes from the Google doc developer meeting minutes: Friday Mar 15, 2024Mini meeting regarding issue 1356 and issue 1415
Discussion regarding converting to d.ts files:
After investigation:
JO: We can’t get d.ts files to work and have mixins anything like we have right now. No!?!?! Here are the problems:
Consensus: JO MK SR do not see a path forward to use d.ts files with mixins. Our mixin definition is a function that takes a class, and returns another class in which the parameter is the supertype. To quote JO, “we are dead in the water with mixins.” SR: What about another language layer on top of typescript to get this to work? Potentially worth investigation, but sounds hard, given IDE support, our current code base and workflows, size of team, etc. OK. so we can’t use our current mixins with current typescript + incremental mode (declaring d.ts files). Potentially actionables: About d.ts files:
Without using d.ts files. There is still the out of memory error when type checking from chipper/tsconfig/all/tsconfig.json
Timing:This iteration?
|
A link to the original meeting notes: https://docs.google.com/document/d/11Gt3Ulalj0fCD2fFeCjPT5ni_9mM2WjkGc4ysisQmo8/edit#heading=h.cpfo2356at26 |
This issue is blocked by phetsims/tasks#1132. Let's go over there to investigate mixins before continuing with d.ts file generation. |
|
|
Alright. @samreid and I did lots of investigation about how best to try to keep imported third party javascript files in Bad ideas we won't do:
Instead, all we need is a We also realized that we don't need to bundle project reference conversion ("composite:true") in with Here is the patch to start for next time: Subject: [PATCH] patch
---
Index: tsconfig-core.json
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/tsconfig-core.json b/tsconfig-core.json
--- a/tsconfig-core.json (revision 980421d810ebbcfd03c0a658549eee7612c6246b)
+++ b/tsconfig-core.json (date 1714518530689)
@@ -14,7 +14,7 @@
"allowJs": true, /* Allow javascript files to be compiled. */
"checkJs": false, /* Report errors in .js files. */
"jsx": "react", /* Specify JSX code generation: 'preserve', 'react-native', 'react', 'react-jsx' or 'react-jsxdev'. */
- "declaration": false, /* Generates corresponding '.d.ts' file. */
+ "declaration": true, /* Generates corresponding '.d.ts' file. */
// "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
"sourceMap": false, /* Generates corresponding '.map' file. */
"outDir": "../chipper/dist/tsc/outDir", /* Redirect output structure to the directory. */
@@ -23,8 +23,8 @@
"composite": false, /* Enable project compilation (project references) */
// "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */
// "removeComments": true, /* Do not emit comments to output. */
- "noEmit": true, /* Emit outputs. */
-// "emitDeclarationOnly": true, /* But not js output, because we use babel ourselves */
+ "noEmit": false, /* Emit outputs. */
+ "emitDeclarationOnly": true, /* But not js output, because we use babel ourselves */
// "importHelpers": true, /* Import emit helpers from 'tslib'. */
// "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
"isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ |
Signed-off-by: Michael Kauzmann <michael.kauzmann@colorado.edu>
Signed-off-by: Michael Kauzmann <michael.kauzmann@colorado.edu>
Signed-off-by: Michael Kauzmann <michael.kauzmann@colorado.edu>
Nice work @zepumph. I also added a commit to add d.ts stubs for 2 perennial files that were getting bundled in. After that change, with the patch in the preceding comment, our entire project generates d.ts files from tsconfig/all then Can we commit the patch above and close this issue? I'm not sure what's left to do. Does @jonathanolson want to start leveraging these/publishing these in scenery stack? |
Signed-off-by: Michael Kauzmann <michael.kauzmann@colorado.edu>
After discussion with @jonathanolson, @samreid and I are now ready to commit this change. Closing. |
Reopening with top priority.
I don't know if 143ff65 is supposed to be a fix, but it didn't work for me after pull. I was able to deploy with |
Thanks, I was able to reproduce the problem and will open a separate issue for discussion. |
OK I opened #1440 and propagated the priority flags. Closing. |
From #1356 and #1415, we discussed creating d.ts files.
@jonathanolson indicated d.ts files are the idiomatic way to provide type declarations to open source clients, and we should do so for the scenery-stack.
In experimenting with generating d.ts files in #1356 (comment) we saw that we get around 15,000 type errors since some features we use for mixins are not supported for d.ts files. We saw a conglomerate issue in microsoft/TypeScript#35822 indicating this and other features not present in d.ts files.
In investigation with @matthew-blackman @jonathanolson and @zepumph, we concluded that the way we use mixins is not compatible with generating d.ts files, so we would like to explore alternatives to mixins as we currently have them. One way would be to "copy/paste" instead.
@jonathanolson said he would like to brainstorm some ways to do so.
UPDATE: after getting d.ts files, please un-hold the following issue and see if it is helped by d.ts files:
The text was updated successfully, but these errors were encountered: