I recently developed an npm package that relies on types from the DefinitelyTyped repository. I added these types as devDependencies in the npm package and was able to use them without any issues, like so:
export class Example {
constructor (options: ExternalTypes.Options) {}
}
However, when users install the npm package and attempt to instantiate the Example class, the ExternalTypes.Options
types are not recognized.
My query is:
How can I incorporate external TypeScript types in an NPM package in a way that ensures users of the package also get access to those types? Should I install types that need to be public as dependencies instead of devDependencies?