(typeName: N, _?: any)
| 29 | function is<N extends TypeNameOneOrMany>(typeName: N, _: any): _ is TypeForTypeNameOneOrMany<N> |
| 30 | function is<N extends TypeNameOneOrMany>(typeName: N): (_: any) => _ is TypeForTypeNameOneOrMany<N> |
| 31 | function is<N extends TypeNameOneOrMany>(typeName: N, _?: any): any { |
| 32 | if (_) { |
| 33 | if (Array.isArray(typeName)) { |
| 34 | // TODO make type field name dynamic (probably will require to code-gen the guard function) |
| 35 | return typeName.some((typeName_) => _?.type === typeName_) |
| 36 | } else { |
| 37 | return typeName === _?.type |
| 38 | } |
| 39 | } else { |
| 40 | return (_: any) => is(typeName, _) |
| 41 | } |
| 42 | } |
| 43 | |
| 44 | export const isType = is |
| 45 |
nothing calls this directly
no outgoing calls
no test coverage detected