Closed atomiks closed 1 year ago
Yeah it is invalid. When TypeScript tries to resolve the types for import 'my-lib'
, it will first see "types": "./src/types.d.ts"
and use that as it matches all the criteria. It won't use the "types"
in "import"
(Exports conditions are order-sensitive)
A fix is to move "types": "./src/types.d.ts"
after the "import"
condition, so the "types"
within the "import"
condition gets the chance to match first.
Usually for types specific linting, https://arethetypeswrong.github.io is more robust too which you can check against.
Ah ok, thanks for the info!
I may be wrong and this is necessary, but I've seen the second setup in a popular open source library - is it invalid or not?
"All good!"
Warning