max() on empty sequence from array throws
vgpro54321 opened this issue · 3 comments
vgpro54321 commented
Hello Guys,
IEnumerable<>.max() function in .NET returns null when sequence is empty (semantics maximum is unknown). LinqToTypeScript throws an error. Is this by design?
vgpro54321 commented
Anybody alive?
arogozine commented
By the design.
under exceptions,
It throws InvalidOperationException if 'source contains no elements'
Only outlier to that are nullable numeric types - which would be number | null
or similar in TS, I suppose. The library only supports max(this: IEnumerable<number>): number
and TSC should error out if you pass anything else in sctrict mode.
vgpro54321 commented
Make sense, thank you!