( object: T, array: readonly E[], )
| 3 | } |
| 4 | |
| 5 | export function isTypeIn<T extends { type?: string }, E extends string>( |
| 6 | object: T, |
| 7 | array: readonly E[], |
| 8 | ): object is Extract<T, { type?: E }> { |
| 9 | if (!object.type) return false; |
| 10 | |
| 11 | return (array as readonly string[]).includes(object.type); |
| 12 | } |
no outgoing calls
no test coverage detected