How to add my .d.ts file to my angular library?

I created the angular library using the Yeoman generator library ( https://github.com/jvandemo/generator-angular2-library ). Then I want to add files with my custom types and put them in the src / types folder, but the compiler doesn't see them.

I tried to use different paths in types, typeRoots in tsconfig.es5.json, but failed so far.

Created a simple repo reproducing the problem: https://github.com/yuriykuzin/ng2-sample-library

Any help is greatly appreciated. Thanks in advance!

+6
source share
1 answer

src/index.ts , , .

, src/index.ts, :

import './types/sample-type';

, dist/types/sample-type.d.ts dist/index.d.ts.

+4

Source: https://habr.com/ru/post/1017315/


All Articles