typescript declare third party modules

后端 未结 3 1392
盖世英雄少女心
盖世英雄少女心 2020-12-15 03:21

How could I declare a third party module which looks like this:

in third party module:

module.exports = function foo(){
  // do somthing
}

3条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-15 04:05

    You declare that function:

    Declare var foo: any;

    This will tell Typescript that somewhere you have a function called foo which you will make sure of get injected on the site.

提交回复
热议问题