How to import a js library without definition file in typescript file

前端 未结 5 1766
温柔的废话
温柔的废话 2020-12-01 03:23

I want to switch from JavaScript to TypeScript to help with code management as our project gets larger. We utilize, however, lots of libraries as amd Modules, which we do no

5条回答
  •  难免孤独
    2020-12-01 03:55

    Ran into that that problem in 2020, and found an easy solution:

    1. Create a decs.d.ts file in the root of your TS project.

    2. Place this declaration:

      declare module 'lib/errorInfoHandler';
      

    This eliminates the error in my case. I'm using TypeScript 3.9.7

提交回复
热议问题