-
Notifications
You must be signed in to change notification settings - Fork 26.2k
Compile error using TypeScript "ReturnType" #24499
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
Comments
Did let s: NonNullable = 7; And get the same error. Cannot find name 'NonNullable'. These are all part of conditional types |
I think the features I want are part of TypeScript 2.8. I have installed the latest TypeScript as described above. Within VS Code when I'm editing a TypeScript file I see in the status bar below 2.9.2. If I click on it I get a choice of whether to use VS Code's version 2.9.2 or the workspace version 2.7.2, which is in the node/modules folder. I've chosen the more recent version. |
Just found this StackOverflow comment If you want to use TS 2.8 you need to use cli version 6.1.0-beta.0 |
Duplicate of #23779 |
What fixed this issue for you ? |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
I'm submitting a...
Current behavior
Create a brand new Angular app. Open in VS Code. Compiles and works fine. Add the following legal TypeScript to a new .ts file in the app folder.
Run
npm build
. Error I receive is `error TS2304: Cannot find name 'ReturnType'. Works fine in an old create-react-app project. The VS Code editor is happy with the code (no red squigglies) but the build process isn't. The status bar shows using TypeScript 2.91.Expected behavior
No build error.
Minimal reproduction of the problem with instructions
ng new ang-app
cd ang-app
ng serve --open
VS Code 1.24
Open folder ang-app
Run build task - no problems
In the app folder, add a file rt.ts with code as shown above
npm build
Error as described above
What is the motivation / use case for changing the behavior?
ReturnType is useful for generating strongly-typed actions (like Redux) with less boilerplate.
Environment
The text was updated successfully, but these errors were encountered: