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