microsoft / TypeScript-Handbook

Deprecated, please use the TypeScript-Website repo instead
https://github.com/microsoft/TypeScript-Website
Apache License 2.0
4.88k stars 1.13k forks source link

Misstatement in definition of `Partial<T>` #1308

Open vassudanagunta opened 4 years ago

vassudanagunta commented 4 years ago

The definition of Partial<T> states:

Constructs a type with all properties of T set to optional. This utility will return a type that represents all subsets of a given type.

To paraphrase Inigo Montoya: You use the word "subset". I do not think it means what you think it means.

A "type with all properties of T set to optional" does not represent subsets of T.

Examples of "subsets of a given type":

I know what the author is trying to say, but can't come up with the right words, though I probably should have spent more time on that than what I've put into this Issue so far 😂.

jpelton-stroud commented 4 years ago

I know what the author is trying to say,

Now that you've brought it up, I've realized I have no idea what the author is trying to say in the second sentence. Partial<T> only returns the params of the targeted type with the optional flag on each one, doesn't it? Does something else happen if the targeted type isn't an object literal?