Created
March 30, 2018 02:23
-
-
Save lmcarreiro/8e14f9af3e66793d0e81d64a5d29e739 to your computer and use it in GitHub Desktop.
filter function overload broken into multiple lines
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function filter<T, U extends T>( | |
array: T[], | |
f: (x: T) => x is U | |
) : U[]; | |
export function filter<T>( | |
array: T[], | |
f: (x: T) => boolean | |
) : T[]; | |
export function filter<T, U extends T>( | |
array: ReadonlyArray<T>, | |
f: (x: T) => x is U | |
): ReadonlyArray<U>; | |
export function filter<T, U extends T>( | |
array: ReadonlyArray<T>, | |
f: (x: T) => boolean | |
): ReadonlyArray<T>; | |
export function filter<T>( | |
array: T[], | |
f: (x: T) => boolean | |
): T[] { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment