티스토리 뷰
최근에이 문제를 발견했으며 다음은 저에게 도움이되는 몇 가지 구성입니다.
DefinitelyTyped @ types / gapi 패키지를 사용하고 있습니다.
npm install --save-dev @types/gapi
typescript docs 에서 /// <reference types="..." />
지시문을 사용 하여 typescript 파일에 유형을로드합니다.
/// <reference types="gapi" />
tsconfig.json
내 프로젝트의 루트 파일에있는 추가 구성 :
{
...
"compilerOptions": {
// I thought this was enough to recognize the types
// but that was not the case
"typeRoots": ["node_modules/@types"],
...
}
}
typescript v2.0 이상을 사용해야합니다.
출처
https://stackoverflow.com/questions/39915890
댓글