You can read the article:
To see how TypeScript compiler analyzes the example, build the package via npm run build
Enhance tsconfig.json
to put types into action:
{
"compilerOptions": {
"*": "Any typescript config options"
},
"files": ["node_modules/YOUR_PACKAGE_NAME/dist/index.d.ts"],
"exclude": ["node_modules"],
"include": ["YOUR_CUSTOM_TYPES.d.ts", "src/**/*"]
}
This is needed since we use some custom package directory. Only types from @types folder is being picked up automatically.