Before compiling the library, we must decide which files to distribute, where to place them, and then we must define an adequate tsconfig.json. TypeScript libraries usually don't distribute TypeScript sources, but distribute the transpiled JavaScript together with TypeScript declaration files.
The main reasons for directly publishing the JavaScript files are as follows:
- The original TypeScript usually needs different tsconfig.json settings (possibly different compiler settings or possibly a different TypeScript compiler version)
- Libraries might need to be processed by processors such as Webpack before being ready for an easy usage
Usually, all files to be distributed are placed in a directory called dist. A TypeScript configuration file such as the following should do the job:
{
"compilerOptions": {
"noImplicitAny": true...