Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- interface NuallablePerson {
- name?: string
- }
- interface Person extends NuallablePerson {
- name: string
- }
- const persons: NuallablePerson[] = [{}, {name: 'test'}, {}, {}]
- const validPersons: Person[] = persons.filter(x => x.name)
- // Type 'NuallablePerson[]' is not assignable to type 'Person[]'. Type 'NuallablePerson' is not assignable to type 'Person'. Types of property 'name' are incompatible. Type 'string | undefined' is not assignable to type 'string'. Type 'undefined' is not assignable to type 'string'.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement