You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In forEach(), x is string because filter() respects User-Defined Type Guards and returns string[].
constvalues=["a",null,"b",null,"c"];values.filter((value): value is string=>typeofvalue==="string").forEach((x)=>{console.log(x.toUpperCase());});
This makes a error because where() returns IEnumerable<string | null> in spite of the enumerable does not contain null.
constvalues=["a",null,"b",null,"c"];Enumerable.from(values).where((value): value is string=>typeofvalue==="string").forEach((x)=>{console.log(x.toUpperCase());});~~~~~~~~~~~~~~~
In lib.es5.d.ts, filter() is defined like this.
filter<SextendsT>(callbackfn: (value: T,index: number,array: T[])=>value is S,thisArg?: any): S[];
So we should add an definition to make it better.
where<SextendsT>(predicate: (element: T,index: number)=>element is S): IEnumerable<S>;
I don't know S is suitable for linq.d.ts or not...
The text was updated successfully, but these errors were encountered:
In forEach(),
x
isstring
because filter() respects User-Defined Type Guards and returnsstring[]
.This makes a error because where() returns
IEnumerable<string | null>
in spite of the enumerable does not contain null.In
lib.es5.d.ts
, filter() is defined like this.So we should add an definition to make it better.
I don't know
S
is suitable forlinq.d.ts
or not...The text was updated successfully, but these errors were encountered: