Reputation: 18895
Given files
Path\Example.ts:
export module Example {
... Stuff ...
}
and Test.ts:
import { Example } from "Path/Example";
let exampleMock = getExampleMock(); // getExampleMock returns an any that matches the type structure of Example
let e = exampleMock as Example; // Errors: Cannot find name 'Example'
let local = Example; // local is typed as Example;
local = exampleMock ; // since exampleMock is an any, compiler allows this call.
... use local with full typing of Example module
Is there any way to type a variable to a module, without setting it to the real module first?
Upvotes: 1
Views: 415