arethetypeswrong / arethetypeswrong.github.io

Tool for analyzing TypeScript types of npm packages
https://arethetypeswrong.github.io
MIT License
1.12k stars 38 forks source link

Incorrectly passing when types missing in package exports #170

Closed benasher44 closed 4 months ago

benasher44 commented 4 months ago

attw reports highlight-words as passing, but TS can't find the types with moduleResolution set to Bundler. I opened a PR with a fix in tricinel/highlight-words#36, and we're not sure whose right. If attw is right, then I suppose I should file a TS bug?

andrewbranch commented 4 months ago

It looks like the change in your PR is actually taking advantage of a TS bug, https://github.com/microsoft/TypeScript/issues/50762. Nothing should ever go after default because all resolvers match default and you’re not supposed to try any conditions after matching one, even if the lookup for that condition fails. I’m not sure why attw is passing without that though; I’ll take a look.

andrewbranch commented 4 months ago

Looking at the trace details on https://arethetypeswrong.github.io/?p=highlight-words%401.2.2, I can’t see anything that looks incorrect. Can you share a repro of it not working in tsc?

benasher44 commented 4 months ago

Ah you know what. I'm on highlight-words 1.2.1, and types were fixed in 1.2.2 🤦 . Closing!