Skip to content

Add Omit as a known interface #30455

Closed
@basarat

Description

@basarat

Search Terms

Omit

Suggestion

Add the following type to lib.d.ts:

type Omit<ObjectType, KeysType extends keyof ObjectType> = Pick<ObjectType, Exclude<keyof ObjectType, KeysType>>;

More

Origin : #12215 (comment)

From : https://github.com/sindresorhus/type-fest/blob/0226ef2092ee2b07a8714c832d106da659877a8f/index.d.ts#L75 Please open new issues on TypeScript about making it built-in.. I searched but couldn't find an issue, so here it is 🌹

Checklist

My suggestion meets these guidelines:

  • This wouldn't be a breaking change in existing TypeScript/JavaScript code
  • This wouldn't change the runtime behavior of existing JavaScript code
  • This could be implemented without emitting different JS based on the types of the expressions
  • This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, etc.)
  • This feature would agree with the rest of TypeScript's Design Goals.

Metadata

Metadata

Labels

Breaking ChangeWould introduce errors in existing codeCommittedThe team has roadmapped this issueFixedA PR has been merged for this issueIn DiscussionNot yet reached consensusSuggestionAn idea for TypeScript

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions