@type/{name}
설치된 NodeJS 패키지 중 하나에 대한 TypeScript 정의 를 찾을 수 없으므로 d.ts
파일 을 작성하고 파일을 {project root}\typings
폴더에 넣으려고 합니다. 이것은 내가하는 방법입니다.
// My source code: index.ts
import Helper from 'node-helper-lib';
// My definition: \typings\node-helper-lib.d.ts
declare....(something else)
declare module 'node-helper-lib' {
class Helper { ... }
export = Helper;
}
그러나 Visual Studio Code는이 오류를 계속 발생시키고 아래에 빨간색 선을 표시합니다 declare module 'node-helper-lib'
.
[ts] 기능 보강에서 유효하지 않은 모듈 이름입니다. 모듈 'node-helper-lib'는 '{project path} \ node_modules \ node-helper-lib \ index.js'에있는 유형이 지정되지 않은 모듈로 확인되며 확장 할 수 없습니다.
라이브러리가 유형이 지정되지 않았기 때문에 여기에 타이핑을 추가 할 수 있어야한다는 것이 합법적이지 않습니까?
최신 정보:
나는 사용하고있다 :
- TypeScript : 2.1.4
- Visual Studio 코드 : 1.9.1
- Node JS : 6.9.4
- Windows 10 x64