Reputation: 26873
Let's say I have an import like import AltContainer from 'alt-container';
. How would you set up a declaration for that? The documentation shows how to achieve this for a module that exports functions but there's no example for this particular case.
Upvotes: 1
Views: 1408
Reputation: 1446
If the exports of the module is itself a function, you can declare a function named exports
from the module.
lib/mymodule.js:
declare module "mymodule" {
declare function exports(foo: string): void;
}
index.js
import f from "mymodule";
f(0); // error: number ~> string
Upvotes: 4