How to allow modules that have missing .d.ts type definition?

后端 未结 2 1773
野的像风
野的像风 2021-01-22 10:18

I\'m using some unpopular modules such as Dyo and js-sha3 which doesn\'t have any types, it seems.

I don\'t really care right now about types i

2条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-22 11:13

    For whoever does not want to create their own .d.ts definition files, you can use "noImplicitAny": false in tsconfig.json to allow using external libraries without TypeScript definition files.

    Example :

    {
      "compileOnSave": false,
      "compilerOptions": {
         ...
        "noImplicitAny": false,
         ...
        }
      }
    }
    

    This allows TypeScript to infer any type from every missing type, hence this will also affect your own project.

提交回复
热议问题