[typescript]Typescript&3rd party libraries

Suyeon·2020년 11월 20일
0

Typescript

목록 보기
11/12

Implement 3rd party libraries(based on javascript) with typescript. Typescript doesn't recognize a library built with javascript.

  • Even though the author didn’t provide typings, there’s still a chance that the wider TypeScript community has stepped in to provide them through the Definitely Typed repository.
  • npm i @types/my-untyped-module

Lodash

  • npm i lodash
  • npm install --save @types/lodash

Declare

<!-- index.html -->
<body>
  <script>
    var GLOBAL = 'This is test'
  </script>
</body>
// app.ts
declare var GLOBAL: string;
console.log(GLOBAL) // This is test
profile
Hello World.

0개의 댓글