The best way to control Claude Code, Codex and more from any computer or phone

main
ts 14 lines 579 Bytes
Raw
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>> => isOutput(value);
7
8 export type IsUnknown<T> = unknown extends T ? (IsAny<T> extends true ? false : true) : false;
9
10 export type UnknownKeys<T> = {
11 [K in keyof T]: IsUnknown<T[K]> extends true ? K : never;
12 }[keyof T];
13
14 export type ExcludeUnknown<T> = IsUnknown<T> extends true ? never : T;