diff --git a/src/utils/types/record-key.ts b/src/utils/types/record-key.ts new file mode 100644 index 0000000..4006f3e --- /dev/null +++ b/src/utils/types/record-key.ts @@ -0,0 +1,8 @@ +/** + * Returns `T` if it extends `PropertyKey`; otherwise, returns `never`. + * + * This is useful to lift the constraints from a record key. + * + * @template T - The type to check if it extends `PropertyKey`. + */ +export type RecordKey = T extends PropertyKey ? T : never;