Reputation: 12005
I have a declared module:
declare module conflicts {
export interface Item {}
export interface Item2 {}
export interface Item3 {}
}
I tried ti import this module in component like:
import * from '../../../_models/conflicts/conflicts';
Then use it:
let c = {} as conflicts.item3;
But it does not work
Upvotes: 0
Views: 58
Reputation: 36
The module declaration should look like the following:
export declare module Conflicts {
export interface Item {}
export interface Item2 {}
export interface Item3 {}
}
The import should be:
import * as conflicts from '../../../_models/conflicts/conflicts';
Then, to use the import, do this:
let c = {} as conflicts.Conflicts.Item3;
Notes:
conflicts
with a lower-case 'c' in the usage is basically the
contents of the import.Conflicts
with a capital 'C' in the usage
is the module itself.as conflicts
part of the import, you can really change conflicts
to anything you want. This is just for setting how the import will be referred to in the rest of the file.Upvotes: 2