Repository navigation
[NewErrors] 4.7.1-rc vs 4.6.4 #49142
Copy link
Copy link
Closed
Description
The following errors were reported by 4.7.1-rc, but not by 4.6.4
coder/code-server
6 of 57 projects failed to build with the old tsc
src/tsconfig.json
error TS2741: Property 'colorSpace' is missing in type '{ width: number; height: number; data: Uint8ClampedArray; }' but required in type 'ImageData'.
facebook/docusaurus
31 of 41 projects failed to build with the old tsc
packages/docusaurus-theme-classic/tsconfig.json
error TS2698: Spread types may only be created from object types.
reduxjs/react-redux
test/typetests/tsconfig.json
error TS2698: Spread types may only be created from object types.
tsconfig.json
error TS2698: Spread types may only be created from object types.
react-bootstrap/react-bootstrap
test/tsconfig.json
error TS2774: This condition will always return true since this function is always defined. Did you mean to call it instead?
tsconfig.json
error TS2774: This condition will always return true since this function is always defined. Did you mean to call it instead?
statelyai/xstate
6 of 20 projects failed to build with the old tsc
packages/xstate-inspect/tsconfig.json
error TS2731: Implicit conversion of a 'symbol' to a 'string' will fail at runtime. Consider wrapping this expression in 'String(...)'.
packages/xstate-test/tsconfig.json
error TS2731: Implicit conversion of a 'symbol' to a 'string' will fail at runtime. Consider wrapping this expression in 'String(...)'.
palantir/blueprint
3 of 25 projects failed to build with the old tsc
packages/docs-theme/src/tsconfig.json
error TS2731: Implicit conversion of a 'symbol' to a 'string' will fail at runtime. Consider wrapping this expression in 'String(...)'.
lensapp/lens
6 of 9 projects failed to build with the old tsc
tsconfig.extension-api.json
error TS2345: Argument of type 'import("/mnt/ts_downloads/lens/node_modules/abort-controller/dist/abort-controller").AbortSignal' is not assignable to parameter of type 'AbortSignal'.error TS2698: Spread types may only be created from object types.
tsconfig.json
error TS2345: Argument of type 'import("/mnt/ts_downloads/lens/node_modules/abort-controller/dist/abort-controller").AbortSignal' is not assignable to parameter of type 'AbortSignal'.error TS2322: Type 'AbortSignal' is not assignable to type 'import("/mnt/ts_downloads/lens/node_modules/@types/node-fetch/externals").AbortSignal'.error TS2698: Spread types may only be created from object types.
webpack/tsconfig.json
error TS2345: Argument of type 'import("/mnt/ts_downloads/lens/node_modules/abort-controller/dist/abort-controller").AbortSignal' is not assignable to parameter of type 'AbortSignal'.error TS2322: Type 'AbortSignal' is not assignable to type 'import("/mnt/ts_downloads/lens/node_modules/@types/node-fetch/externals").AbortSignal'.error TS2698: Spread types may only be created from object types.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Activity
Josh-Cena commentedon May 17, 2022
I'd like to know if there's a better way to do this, without using
as any. I've expressed the same concern in #48556 (comment)DanielRosenwasser commentedon May 17, 2022
I would probably switch to
as {}. Unlike unioning aneverwith other types (where you are enriching the absence of execution with possible executions), spreading aneversort of implies that you should getneverout of it.Josh-Cena commentedon May 18, 2022
Sigh What if I told you that
{}is banned by TypeScript-ESLint as well😄 But thanks for that tip, it makes sense. I'll negotiate with my linter.DanielRosenwasser commentedon May 18, 2022
Wh-really? Why? Because it insists on using
object?Josh-Cena commentedon May 18, 2022
Yeah, the reason is because
{}doesn't do excess property checks and even accepts primitives, so people using it to represent "empty object" would often shoot themselves in the foot. See@typescript-eslint/ban-typesJosh-Cena commentedon May 18, 2022
Also,
{}doesn't work, because in fact, the compiler only accepts props that's assignable to props of bothdivandpre, which seems to reduce tonever. We'll useas anyfor now, but I hope there's a better pattern to do this, possibly withoneofgenerics.RyanCavanaugh commentedon May 19, 2022
Opened react-bootstrap/react-bootstrap#6345
RyanCavanaugh commentedon May 20, 2022
I would use
as objectinstead ofas anyJosh-Cena commentedon May 20, 2022
Ref typescript-eslint/typescript-eslint#5018 (comment)
But
as objectdoesn't fix that particular error😢 I have yet to know a fixThe interesting thing is even not passing any props won't work. I think it's already intersecting to
neverin the generic body.UNIDY2002 commentedon May 25, 2022
Hi, I also encountered a similar error after upgrading my TypeScript. I am using
AbortControllerfromabort-controller, and here is my code:TypeScript raises an error saying:
I am wondering is there a proper way to solve this error. Thanks!
DanielRosenwasser commentedon May 25, 2022
You may want to file a bug on
abort-controlleror add the following to yourpackage.jsonandnpm install.