0

So I have this structure:

node_modules/
   @types/express/
   express/
express/index.ts
main.ts

in express/index.ts, I had this:

import {RequestHandler} from 'express';

and it wouldn't resolve. I had the same call in main.ts and that import would not resolve either. I finally figured out that it as because I had a folder named express with an index.ts file in it. At first I thought it was just JetBrains that was messing up, but tsc at the command line couldn't resolve it either.

This seems like a bug with typescript - I don't see why the resolution algorithm for TS should be different than the node_modules lookup algorithm. Is this a bug or not?

Alexander Mills
  • 90,741
  • 139
  • 482
  • 817

0 Answers0