(arr: U[], v: V)
| 46 | // Apparently the idiomatic solution is arr.filter((x): x is T => x !== null), but this is shorter (and the type |
| 47 | // predicate also isn't type checked so it doesn't seem safe to me) |
| 48 | export function remove<U, V extends U>(arr: U[], v: V) { |
| 49 | return arr.filter(item => item !== v) as Exclude<U, V extends null | undefined ? V : never>[]; |
| 50 | } |
| 51 | |
| 52 | // https://www.typescriptlang.org/play?#code/KYDwDg9gTgLgBAMwK4DsDGMCWEVysAWwgDdgAeAVQBo4A1OUGYFAEwGc4KA+ACgEMoUAFycA2gF0axEbQCUcAN4AoOKrzAYSKLgFQAdAkwAbJlB6YmBOAF4ucC4TgBCa9bjF5fDgFEQaI0gs5NR0DCBMrBwoSEZGcAA+cKhBhijALHAA-KEiaaRQXBIA3EoAvkpKQf4CwHBoOGzwuiI8jVCYKADmCXDRsbLFFfUojXAgNupEpPyCNH1GsiUA9EtqcAB6mUMN8ACeE-hTwDNQNABECBAQZ4tKK2ubFUA |
| 53 |
nothing calls this directly
no outgoing calls
no test coverage detected