Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Convert $Diff<T, U> -> Omit<T, keyof U>#396

Open
seansfkelley wants to merge 1 commit intoKhan:masterfrom
seansfkelley:diff-to-omit
Open

Convert $Diff<T, U> -> Omit<T, keyof U>#396
seansfkelley wants to merge 1 commit intoKhan:masterfrom
seansfkelley:diff-to-omit

Conversation

@seansfkelley
Copy link
Copy Markdown

@seansfkelley seansfkelley commented Jan 24, 2024

This is a lossy conversion, since Flow requires that U is an object type and that T (1) has all the keys of U and (2) the corresponding values of T are assignable to those of U. A closer analogue would use OmitStrict instead of Omit (where type OmitStrict<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>) but using the standard Omit means we don't need to add potentially-conflicting definitions elsewhere to import here.

This is a lossy conversion, since Flow requires that `U` is an object
type and that `T` (1) has all the keys of `U` and (2) the corresponding
values of `T` are assignable to those of `U`. A closer analogue would
use `OmitStrict` instead of `Omit` (where
`type OmitStrict<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>`)
but using the standard `Omit` means we don't need to add
potentially-conflicting definitions elsewhere to import here.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant