| 1 | import type { Input } from "../Input.ts"; |
| 2 | import { type Output, isOutput } from "../Output.ts"; |
| 3 | import type { IsAny } from "./types.ts"; |
| 4 | |
| 5 | // @ts-expect-error - we want to allow any value to be checked for unknown |
| 6 | export const isUnknown = <V>(value: V): value is Output<Input.Resolve<V>> => |
| 7 | isOutput(value); |
| 8 | |
| 9 | export type IsUnknown<T> = unknown extends T |
| 10 | ? IsAny<T> extends true |
| 11 | ? false |
| 12 | : true |
| 13 | : false; |
| 14 | |
| 15 | export type UnknownKeys<T> = { |
| 16 | [K in keyof T]: IsUnknown<T[K]> extends true ? K : never; |
| 17 | }[keyof T]; |
| 18 | |
| 19 | export type ExcludeUnknown<T> = IsUnknown<T> extends true ? never : T; |