I'm a new typescript developer, and I'm working on a project with typescript and webpack, some library which are coded with js need a .d.ts file, but I'm confused how webpack finds a .d.ts file with import * as PIXI from 'pixi.js'?
Here are my guesses:
webpack will find the folder which is named
pixi.jsin "node_modules", and find the package.json in it, and if it has thetypesproperty, just pick the file as the .d.ts file.if it can't find a .d.ts file in the way of 1, it goes to the node_modules/@types(or other custom folder), finds if there is a folder which has the same name
pixi.js, and picks theindex.d.tsfile as the.d.tsfile.- btw, I found in the index.d.ts they use the
module, why? I know that the official does not recommend themodulekeyword(which is replaced bynamespace).