0

I am new to Angular, Can someone please help me out with this issue here.

export class PersonComponent implements OnInit {

  Schools= [];
  
  constructor() { 
  }

  ngOnInit(): void {

  this.Schools= [
    {Name : "ABD Schoool" , Title : "Colarado"},
    {Name : "CC School" , Title : "Texas"}
  ];

  }

}

However, I am getting an error stating 'Type string is not assignable to type never'. What does this mean and how can I solve this?

1 Answer 1

1

Try:

  schools: any[] = [];

Without defining the array type, it's by default of type never.

Sign up to request clarification or add additional context in comments.

1 Comment

now i get Type '{ Name: string; Title: string; }' is not assignable to type 'string'.ts(2322)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.