Issue
I have interface items.ts:
export interface item{
Name: string;
IsSystemItem: string;
ConfiguredSegments: ConfiguredSegments;
}
export interface ConfiguredSegments {
LiveA: LiveA;
}
export interface LiveA {
Weight: number;
Id: string;
}
I have a class where i am filling an array of items mockitems.ts :
export const items: item[] = [
{
Name: "Default Item",
IsSystemItem: "yes",
ConfiguredSegments: ConfiguredSegments.LiveA // Here it is throwing error "Cannot find name
ConfiguredSegments"
}
]
How to fill ConfiguredSegments field ?
Solution
ConfiguredSegments is an interface and not an object so you can not use it as a value. So you need to do
export const items: item[] = [
{
Name: "Default Item",
IsSystemItem: "yes",
ConfiguredSegments: {
LiveA: {
Weight: 123,
Id: 'yourId'
}
}
}
]
Answered By - japrescott
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.