You can force compilation if the module does not adhere to such an interface (technically non-zero overhead at runtime, but this hardly matters):
interface foo {
bar(): number;
}
module mod {
export function bar(): number {
return 0;
}
}
var mod_is_foo: foo = mod;
module mod implements foo? 100.
- ( ) , var , var:
<foo>mod;
<foo>undefined === mod;