Error: Node TemplateLiteralType was unexpected
See original GitHub issueDescribe the bug As soon as i use a so-called Template Literal Type (a TypeScript 4.2 feature) in one of my components, storybook can not load it and gets errors.
To Reproduce Create project.
- Angular 12.1.1
- TS 4.2.4
- Storybook 6.3.2
Write this in any component:
enum ThemeEnum {
DANGER = 'danger',
SUCCESS = 'success',
}
const theme : ThemeEnum | `${ThemeEnum}` = 'danger';
Additional context Errors look like this:
Unexpected error while loading ./path/foo.component.stories.ts: Error: Module build failed (from ./node_modules/ts-loader/index.js):
Error: Debug Failure. Unexpected node.
Node TemplateLiteralType was unexpected.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:5
- Comments:5 (3 by maintainers)
Top Results From Across the Web
TypeScript Unexpected Ideentifier - node.js - Stack Overflow
I my code is like the below but i couldn't work on my function because of Unexpected Identifier error.
Read more >Node.js course - getting same error when using template ...
I get this error any time i try to run the app and I cant find any resources to help me. when the...
Read more >I need to learn about TypeScript Template Literal Types
It gives an error because of infinite recursion, but it seems to work ... ParserError<`ParseJsonValue returned unexpected value for: ...
Read more >Allow Literal String Values With Enum TypeScript Type
No); // error: Argument of type '"accepted"' is not assignable to ... When an enum is used as a template literal type, it...
Read more >[Solved]-Typescript Constructor Parameters. Parsing error
Coding example for the question Typescript Constructor Parameters. Parsing error: Unexpected reserved word 'public'-Reactjs.
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
Ok, FYI, Angular 12 requires TypeScript 4.2, and Angular 13 requires TypeScript 4.4. Anyone looking to take advantage of new TypeScript features in their Angular projects will run into this type of issue when Storybook builds.
We’ll definitely upgrade it for 7.0, our next major release, which is coming later this year. @ndelangen you looked at this recently – any chance we’ll get to it sooner?