34 lines
1.6 KiB
Plaintext
34 lines
1.6 KiB
Plaintext
=== tests/cases/compiler/arrayFilter.ts ===
|
|
var foo = [
|
|
>foo : { name: string; }[]
|
|
>[ { name: 'bar' }, { name: null }, { name: 'baz' }] : { name: string; }[]
|
|
|
|
{ name: 'bar' },
|
|
>{ name: 'bar' } : { name: string; }
|
|
>name : string
|
|
>'bar' : "bar"
|
|
|
|
{ name: null },
|
|
>{ name: null } : { name: null; }
|
|
>name : null
|
|
>null : null
|
|
|
|
{ name: 'baz' }
|
|
>{ name: 'baz' } : { name: string; }
|
|
>name : string
|
|
>'baz' : "baz"
|
|
|
|
]
|
|
|
|
foo.filter(x => x.name); //should accepted all possible types not only boolean!
|
|
>foo.filter(x => x.name) : { name: string; }[]
|
|
>foo.filter : { (callbackfn: (this: undefined, value: { name: string; }, index: number, array: { name: string; }[]) => any): { name: string; }[]; (callbackfn: (this: undefined, value: { name: string; }, index: number, array: { name: string; }[]) => any, thisArg: undefined): { name: string; }[]; <Z>(callbackfn: (this: Z, value: { name: string; }, index: number, array: { name: string; }[]) => any, thisArg: Z): { name: string; }[]; }
|
|
>foo : { name: string; }[]
|
|
>filter : { (callbackfn: (this: undefined, value: { name: string; }, index: number, array: { name: string; }[]) => any): { name: string; }[]; (callbackfn: (this: undefined, value: { name: string; }, index: number, array: { name: string; }[]) => any, thisArg: undefined): { name: string; }[]; <Z>(callbackfn: (this: Z, value: { name: string; }, index: number, array: { name: string; }[]) => any, thisArg: Z): { name: string; }[]; }
|
|
>x => x.name : (this: undefined, x: { name: string; }) => string
|
|
>x : { name: string; }
|
|
>x.name : string
|
|
>x : { name: string; }
|
|
>name : string
|
|
|