-
Notifications
You must be signed in to change notification settings - Fork 767
Open
Description
Still getting these types of errors even after the fixes for #1034.
Steps to reproduce
package.json:
{
"type": "module",
"dependencies": {
"@stylexjs/stylex": "0.16.2"
}
}
tsconfig.json:
{
"compilerOptions": {
"module": "node20",
"moduleResolution": "node16",
"skipLibCheck": true,
"declaration": true,
}
}
stylex.ts:
import * as stylex from '@stylexjs/stylex'
export default { ...stylex } as { [K in keyof typeof stylex]: (typeof stylex)[K] }
Behavior with typescript@5.9
No error.
Behavior with tsgo
stylex.ts:3:1 - error TS2742: The inferred type of 'default' cannot be named without a reference to './node_modules/@stylexjs/stylex/lib/es/types/StyleXCSSTypes.js'. This is likely not portable. A type annotation is necessary.
3 export default { ...stylex } as { [K in keyof typeof stylex]: (typeof stylex)[K] }
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
stylex.ts:3:1 - error TS2742: The inferred type of 'default' cannot be named without a reference to './node_modules/@stylexjs/stylex/lib/es/types/StyleXUtils.js'. This is likely not portable. A type annotation is necessary.
3 export default { ...stylex } as { [K in keyof typeof stylex]: (typeof stylex)[K] }
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Found 2 errors in the same file, starting at: stylex.ts:3
There's a straightforward workaround for me -- simplify { [K in keyof typeof stylex]: (typeof stylex)[K] } to typeof stylex. Reporting in case this is a variant of #1034 you want to fix.
This one doesn't appear to be related to pnpm. It repros with npm i.
thdk
Metadata
Metadata
Assignees
Labels
No labels