Quantcast
Channel: The reality of my fantasy life
Viewing all articles
Browse latest Browse all 39

Runtime Error: Cannot find module 'foobar.d.ts' from Typescript

$
0
0
Continuing on with the theme of me using my illustrious blog as a dumping ground:

This runtime error puzzled me. It compiled cleanly in Typescript, but at runtime raised an error. It shouldn't have even been compiled in the first place. So what's the deal?

`Error: Cannot find module '../../../typings/foobar'`

Well, the deal is pretty simple. The typing file contained an enum data structure. Since those get converted to actual code, that meant that the compiler emitted a 'require' statement for the type definition file, which meant that Node tried to load it... can't load a d.ts file at runtime, can you?

Viewing all articles
Browse latest Browse all 39

Latest Images

Trending Articles





Latest Images