Advertisement
Guest User

Untitled

a guest
Jul 19th, 2017
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. interface NuallablePerson {
  2.     name?: string
  3. }
  4.  
  5. interface Person extends NuallablePerson {
  6.     name: string
  7. }
  8.  
  9. const persons: NuallablePerson[] = [{}, {name: 'test'}, {}, {}]
  10. const validPersons: Person[] = persons.filter(x => x.name)
  11.  
  12. // 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