Skip to content

Commit

Permalink
Merge pull request #107 from Neuroboy23/master
Browse files Browse the repository at this point in the history
add overrides for type guard predicates
  • Loading branch information
mihaifm authored Oct 18, 2023
2 parents 45a45fb + f7a3dc9 commit d9a8efb
Showing 1 changed file with 22 additions and 5 deletions.
27 changes: 22 additions & 5 deletions linq.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ declare namespace Enumerable {
selectMany<TCollection, TResult>(collectionSelector: (element: T, index: number) => TCollection[], resultSelector: (outer: T, inner: TCollection) => TResult): IEnumerable<TResult>;
selectMany<TOther>(collectionSelector: (element: T, index: number) => { length: number;[x: number]: TOther; }): IEnumerable<TOther>;
selectMany<TCollection, TResult>(collectionSelector: (element: T, index: number) => { length: number;[x: number]: TCollection; }, resultSelector: (outer: T, inner: TCollection) => TResult): IEnumerable<TResult>;
where<TOther extends T>(predicate: (element: T, index: number) => element is TOther): IEnumerable<TOther>;
where(predicate: (element: T, index: number) => boolean): IEnumerable<T>;
choose(selector: (element: T, index: number) => T): IEnumerable<T>;
ofType<TResult>(type: unknown): IEnumerable<TResult>;
Expand Down Expand Up @@ -142,14 +143,30 @@ declare namespace Enumerable {
sum(selector?: (element: T) => number): number;
elementAt(index: number): T;
elementAtOrDefault(index: number, defaultValue?: T): T | undefined;
first<TOther extends T>(predicate: (element: T, index: number) => element is TOther): TOther;
first(predicate?: (element: T, index: number) => boolean): T;
firstOrDefault(predicate?: (element: T, index: number) => boolean, defaultValue?: T): T | undefined;
firstOrDefault(defaultValue?: T): T | undefined;
firstOrDefault<TOther extends T, TDefault>(predicate: (element: T, index: number) => element is TOther, defaultValue: TDefault): TOther | TDefault;
firstOrDefault<TDefault>(predicate: (element: T, index: number) => boolean, defaultValue: TDefault): T | TDefault;
firstOrDefault<TOther extends T>(predicate: (element: T, index: number) => element is TOther): TOther | undefined;
firstOrDefault(predicate: (element: T, index: number) => boolean): T | undefined;
firstOrDefault<TDefault>(defaultValue: TDefault): T | TDefault;
firstOrDefault(): T | undefined;
last<TOther extends T>(predicate: (element: T, index: number) => element is TOther): TOther;
last(predicate?: (element: T, index: number) => boolean): T;
lastOrDefault(predicate?: (element: T, index: number) => boolean, defaultValue?: T): T | undefined;
lastOrDefault(defaultValue?: T): T | undefined;
lastOrDefault<TOther extends T, TDefault>(predicate: (element: T, index: number) => element is TOther, defaultValue: TDefault): TOther | TDefault;
lastOrDefault<TDefault>(predicate: (element: T, index: number) => boolean, defaultValue: TDefault): T | TDefault;
lastOrDefault<TOther extends T>(predicate: (element: T, index: number) => element is TOther): TOther | undefined;
lastOrDefault(predicate: (element: T, index: number) => boolean): T | undefined;
lastOrDefault<TDefault>(defaultValue: TDefault): T | TDefault;
lastOrDefault(): T | undefined;
single<TOther extends T>(predicate: (element: T, index: number) => element is TOther): TOther;
single(predicate?: (element: T, index: number) => boolean): T;
singleOrDefault(predicate?: (element: T, index: number) => boolean, defaultValue?: T): T | undefined;
singleOrDefault<TOther extends T, TDefault>(predicate: (element: T, index: number) => element is TOther, defaultValue: TDefault): TOther | TDefault;
singleOrDefault<TDefault>(predicate: (element: T, index: number) => boolean, defaultValue: TDefault): T | TDefault;
singleOrDefault<TOther extends T>(predicate: (element: T, index: number) => element is TOther): TOther | undefined;
singleOrDefault(predicate: (element: T, index: number) => boolean): T | undefined;
singleOrDefault<TDefault>(defaultValue: TDefault): T | TDefault;
singleOrDefault(): T | undefined;
skip(count: number): IEnumerable<T>;
skipWhile(predicate: (element: T, index: number) => boolean): IEnumerable<T>;
take(count: number): IEnumerable<T>;
Expand Down

0 comments on commit d9a8efb

Please sign in to comment.