-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
[core] Avoid node
types in the built packages
#17533
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
base: master
Are you sure you want to change the base?
Conversation
@@ -8,7 +8,9 @@ | |||
"noEmit": false, | |||
"emitDeclarationOnly": true, | |||
"outDir": "build/esm", | |||
"rootDir": "./src" | |||
"rootDir": "./src", | |||
"skipLibCheck": true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without this compilation failed due to not finding node
types in the exceljs
lib.
I don't think it's that important to check this validity twice (typescript
step already checks with node
types defined).
Deploy preview: https://deploy-preview-17533--material-ui-x.netlify.app/ |
@@ -14,7 +14,7 @@ export class TimerBasedCleanupTracking implements CleanupTracking { | |||
|
|||
register(object: any, unsubscribe: UnsubscribeFn, unregisterToken: UnregisterToken): void { | |||
if (!this.timeouts) { | |||
this.timeouts = new Map<number, NodeJS.Timeout>(); | |||
this.timeouts = new Map<number, ReturnType<typeof setTimeout>>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given that we need specificity to have conclusive types, I would vote for reverting mui/mui-public#195 and using window.setTimeout
with return type of number
instead of relying on terse ReturnType<typeof setTimeout>
, which would now return NodeJS.Timeout
in IDE/JSDoc and number
in built output.
Fixes #17477.
Removing the usage of
node
in thetsconfig.compilerOptions.types
to avoidNodeJS
types in the built packages.The drawback of this approach is inconclusive JSDoc/IntelliSense.
Hovering over methods shows
node
JSDoc where available, while the built output will have a different API (i.e.setTimeout
).I don't know how to easily avoid having
node
types in the project config, since there are numerous usages ofpath
,__dirname
and similar things, especially in test files.