## Search Terms omit strict ## Suggestion The [new `Omit` type](https://github.com/Microsoft/TypeScript/pull/30552) does not restrict the omitted keys to be keys actually present on the given type. There should be some avenue to express "omit, but only with keys that are present", likely either a change to `Omit` or some other `Omit`-like type. ## Use Cases Copied from https://github.com/pelotom/type-zoo/pull/31. The benefit that a stricter type has is primarily: - Preventing typos. - Allowing the compiler to pick up on rename refactors automatically. Currently, permissive Omit acts as a "barrier" that prevents rename refactors from passing through, which means that any such refactor generates whole bunches of errors that have to be manually fixed. If the field in question is optional, this can actually introduce bugs. And some further color: I generally use `Omit` with string literal unions (as opposed to, say, generic types that `extends string`), because I often use them for defining higher-order React components that wrap another component _except_ for this one prop. As such, in my use case, I never want a permissive `Omit`. ## Examples ```tsx interface ImplementationDetailProps { publiclyVisibleFoo: Foo; filePrivateBar: Bar; } class ImplementationDetail extends React.Component<ImplementationDetailProps> { ... } export type PublicProps = Omit<ImplementationDetailProps, "filePrivateBar">; export class Public extends React.Component<PublicProps> { ... } ``` ## Checklist My suggestion meets these guidelines: * [x] This wouldn't be a breaking change in existing TypeScript/JavaScript code * [x] This wouldn't change the runtime behavior of existing JavaScript code * [x] This could be implemented without emitting different JS based on the types of the expressions * [x] This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, etc.) * [x] This feature would agree with the rest of [TypeScript's Design Goals](https://github.com/Microsoft/TypeScript/wiki/TypeScript-Design-Goals).