Angular CLI库打字稿路径不起作用

时间:2019-07-17 04:31:00

标签: angular typescript angular-cli

我有一个angular cli项目,并创建了一个新库:

find

现在,在class A { static method() { this._open() } static _open() { console.log('opening'); } } function find(query, data) { const keys = query.split('.'); const lastKey = keys.pop(); const lastObj = keys.reduce((obj, val) => { return obj ? obj[val] : obj }, data); const ret = lastObj[lastKey]; return typeof ret === 'function' ? ret.bind(lastObj) : ret; } // func is a reference to `method` let func = find('A.method', { A: A }); func('param 1', 'param 2')文件中,我添加了以下ng g library test 选项:

tsconfig.json

但是现在当我尝试在应用程序中使用它时:

paths

我得到了错误:

  

错误TS2307:找不到模块'@ scope / name'。

1 个答案:

答案 0 :(得分:1)

您可以使用文件。你有错字。应该是:

"@scope/name": ["projects/test/src/public-api.ts"]
相关问题