Skip to content
Draft
Changes from 2 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
5 changes: 3 additions & 2 deletions source/except.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type {ApplyDefaultOptions} from './internal/index.d.ts';
import type {IsEqual} from './is-equal.d.ts';
import type {LiteralUnion} from './literal-union.d.ts';

/**
Filter out keys from an object.
Expand Down Expand Up @@ -100,10 +101,10 @@ type PostPayloadFixed = Except<UserData, 'email'>;

@category Object
*/
export type Except<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions = {}> =
export type Except<ObjectType, KeysType extends LiteralUnion<keyof ObjectType, PropertyKey>, Options extends ExceptOptions = {}> =
_Except<ObjectType, KeysType, ApplyDefaultOptions<ExceptOptions, DefaultExceptOptions, Options>>;

type _Except<ObjectType, KeysType extends keyof ObjectType, Options extends Required<ExceptOptions>> = {
type _Except<ObjectType, KeysType extends PropertyKey, Options extends Required<ExceptOptions>> = {
[KeyType in keyof ObjectType as Filter<KeyType, KeysType>]: ObjectType[KeyType];
} & (Options['requireExactProps'] extends true
? Partial<Record<KeysType, never>>
Expand Down