Reputation: 133
My object instantiation using a constructor declared for the interface:
let obj = new Output(cur.req, cur.type, cur.batchId, cur.rowId, dat2);
Model data structure
import { Data } from './data';
export interface Output {
req: string;
type: string;
batchId: number;
rowId: number;
data: Array<Data>
}
export interface OutputConstructor {
new (req: number, type: string, batchId: number, rowId: number, data:Array<Data>): Output;
Clone(): Output;
}
export var Output: OutputConstructor;
Upvotes: 7
Views: 26886
Reputation: 479
Like another user said before, Output is an interface. So what you have to do to set the type is this:
let obj = {} as Output;
Upvotes: 11
Reputation: 1074485
Output
is an interface, not a class. You can't directly instantiate an interface.
Upvotes: 19