import { ToNumber } from "./ToNumber.js"; import { TupleKeys } from "./TupleKeys.js"; /** * Check if K is a fixed index in tuple T (not part of the rest portion). */ type IsRestKeyOrOptional = K extends TupleKeys ? (T[K] extends undefined ? true : false) : true; /** * Can't simply use T[K] because if T is a union type, then K may not be a key, * when really we want to just treat it as an optional key. */ export type GetKey = T extends readonly unknown[] ? IsRestKeyOrOptional extends true ? T[ToNumber] | undefined : T[ToNumber] : T extends { [k in K]: infer V; } ? V : T extends { [k in K]?: infer V; } ? V | undefined : undefined; export {}; //# sourceMappingURL=GetKey.d.ts.map