@kamilogorek
Kamil Ogórek
1 year
Automatic loading of `@​types/x` dirs by TypeScript compiler is a real shitshow when you have transitive dep you are not aware of. It will override your own types without blinking an eye and good luck realizing this in the first place. Being explicit is always better than magic.
2
3
14

Replies

@kamilogorek
Kamil Ogórek
1 year
Not to mention polluting the global namespace by 3rd party libs. Something that @ThePrimeagen mentioned in his recent "Matt Fixes TypeScript" video just bit me right in the ass. One test runner overshadowed other test runner types because its types were imported by 3rd party. Ugh
1
0
2
@kamilogorek
Kamil Ogórek
1 year
In case you're wondering what actually bit me - cc @trpcio @alexdotjs @kentcdodds @vitest_dev as maybe there's already a known similar case where it happened before that you are aware of.
1
1
3
@andhaveaniceday
Jake Bailey
1 year
@kamilogorek Definitely recommend explicitly setting "types" in your tsconfig: (Wish we could make the default be the empty array, but...)
1
0
1
@kamilogorek
Kamil Ogórek
1 year
@andhaveaniceday Setting types explicitly doesn't prevent triple-slash declarations from being registered unfortunately.
0
0
0