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