Answer the question
In order to leave comments, you need to log in
Why does typescript swear at non-interface properties?
export class HeroesComponent implements OnInit {
hero: Hero = {
id: 1,
name: 'Windstorm',
extra: 'any'
};
export default interface Hero {
id: number;
name: string;
}
Answer the question
In order to leave comments, you need to log in
export default interface Hero {
id: number;
name: string;
extra?: string;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question