After generating my definition file ".d.ts" using tsc --declaration or setting declaration as true in the tsconfig.json, I noticed that the generated files are missing
declare module "mymodule" {... }
This appears to be causing issues with "tslint" which warns me about "Unsafe use of expression of type 'any'." For instance, in the file "test.ts" :
type PromiseResolve<T> = (value?: T | PromiseLike<T> | undefined) => void;
export async function delay(timeout: number): Promise<boolean> {
return new Promise((resolve: PromiseResolve<boolean>): void => {
setTimeout(() => { resolve(true); }, timeout);
});
}
The generated output will be:
export declare function delay(timeout: number): Promise<boolean>;
but what I actually need is:
declare module "mymodule"
{
export declare function delay(timeout: number): Promise<boolean>;
}
Is there a way to ensure that 'declare module "mymodule"{……}' appears at the top of the generated .d.ts file? Or how can I make tslint work properly even without this declaration?