Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/client/types/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,17 @@ export type OmitByType<T, Type> = Pick<
{ [K in keyof T]-?: T[K] extends Type ? never : K }[keyof T]
>;

// TS 6.0 infers the exact argument shape (unknown keys included), so T[K]
// checks a value against itself — excess keys pass. U[K] checks against the
// declared shape instead. The phantom-key branch keeps T[K] referenced so
// TypeScript still infers T and Payload<T,U> still narrows to selected fields.
// https://github.com/microsoft/TypeScript/issues/63515
export type Options<T, U> = {
[K in keyof T]: K extends keyof U ? T[K] : never;
[K in keyof T]: K extends keyof U
? K extends "__use_T_so_it_is_inferred__"
? T[K]
: U[K]
: never;
};

export type OrderBy = "ASC" | "DESC";