Type Checking on Typescript project finds errors with an unchanged project
See original GitHub issueExpected Behavior
Type checking on a unchanged fresh typescript project to return 0 errors
Current Behavior
Type checking on an unchanged fresh typescript project returns
(node:19764) ExperimentalWarning: stream/web is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
✔ Generating the Prisma client...
✔ Generating types
src/App.tsx:10:4 - error TS2786: 'FatalErrorBoundary' cannot be used as a JSX component.
Its instance type 'FatalErrorBoundary' is not a valid JSX element.
The types returned by 'render()' are incompatible between these types.
Type 'import("/Users/katrinaknight/Projects/redwood/test-app/node_modules/@types/react/index").ReactNode' is not assignable to type 'import("/Users/katrinaknight/Projects/redwood/test-app/node_modules/@types/react-dom/node_modules/@types/react/index").ReactNode'.
Type '{}' is not assignable to type 'ReactNode'.
10 <FatalErrorBoundary page={FatalErrorPage}>
~~~~~~~~~~~~~~~~~~
Found 1 error in src/App.tsx:10
Steps to Reproduce
- yarn create redwood-app --ts test-app
- cd test-app
- yarn rw type-check
Why this effects things
This doesn’t effect me too much right now, as long as it can be ignored and will show other errors in addition to this one, but it is a minor issue if I try to later do CI based on the type-checking.
Issue Analytics
- State:
- Created a year ago
- Reactions:6
- Comments:5 (3 by maintainers)
Top Results From Across the Web
TypeScript Errors in a Javascript Project that has no ...
js project (type: javascript) with no ts files in it (go figure) that is throwing 3 typescript errors: Error TS2304 Cannot find name...
Read more >Achieve Project-Wide Type Checking with TypeScript and ...
Type errors only show up in open files, which only become apparent after a build fails. As it turns out, VS Code does...
Read more >TSConfig Reference - Docs on every TSConfig option
From allowJs to useDefineForClassFields the TSConfig reference includes information about all of the active compiler flags setting up a TypeScript project.
Read more >Upgrading to 15.5.x causes TS2559 errors to appear in ...
After upgrading from 15.4.x to 15.5.x, a large number of TS2559 errors appear in the Error List window and offending types are underlined...
Read more >Understanding TypeScript Configuration Options
Normally it will be used as type checking in JavaScript project. ... When checkJs is enabled, TypeScript will raise errors for JavaScript files....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Maybe relevant: https://github.com/facebook/react/issues/24304
So I don’t know why we have react-18 types. But the issue here is that in the react 17 types
ReactNode
includes{}
. It was removed in the react 18 types. So assigning from react 17ReactNode
to react 18ReactNode
is not possible (but the other way around would be fine)React 17:
React 18:
This is only a problem in RW Apps, not the framework itself. For the framework we still get react 17 typings for both react and react-dom
Is it react-syntax-highlighter that’s the problem?
A few other things worth looking into, from a project’s yarn.lock
I found out about the
-R
flag foryarn why
So. Workaround for now:
Add this to your project’s root
package.json
:Related Issue now open on DefinitelyTyped repo: https://github.com/microsoft/DefinitelyTyped-tools/issues/433