guybedford / es-module-lexer

Low-overhead lexer dedicated to ES module parsing for fast analysis
MIT License
933 stars 48 forks source link

Adding `types` entry to exports map. #134

Closed dzearing closed 2 years ago

dzearing commented 2 years ago

When using this package in a TypeScript environment which uses moduleResolution: 'nodenext', TypeScript won't find the typings unless the exports map entries include a types key. (E.g. it ignores the one at root.)

Another remedy is to include typings right next to the source. I believe TypeScript will find them this way as well.

Tested locally by adding this entry made TS happy. :)

guybedford commented 2 years ago

Thanks for the PR!