question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error: Node TemplateLiteralType was unexpected

See original GitHub issue

Describe 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:open
  • Created 2 years ago
  • Reactions:5
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
JSMikecommented, Feb 3, 2022

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.

0reactions
shilmancommented, Feb 1, 2022

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?

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found