-
Notifications
You must be signed in to change notification settings - Fork 12.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Usages of Partial accept primitives #14224
Comments
@mhegazy I strongly believe that the intent of Partial is to provide support for creating interfaces which all optional members while also enforcing that usages of it do not accept primitives. The new object type can be used to cover the entire intent as mentioned in #14249. |
#14249 talks about adding a constraint on the parameter of Mapped types are just a transformation, the generated type is just like any type you would write manually.. e.g. |
@mhegazy I am just fine with using Partial as simply a mapped typed, just as a transformation, and then manually add the intent of always being an object. It is not a workaround but an explicit way of doing what I initially thought would be done implicitly. Thanks for all the clarifications. They have helped me while having this issue discussed. |
TypeScript Version: 2.2
Code
Expected behavior:
Primitives should not be allowed to be passed in arguments.
Primitives should be excluded when using Partial.
The new object type, added with 2.2, can be used implicitly when using Partial construct without having to explicitly use it to have a workaround for this issue.
Actual behavior:
Usages of Partial accept primitives, even though the intent is that primitives be excluded.
Can explicitly also use the new object type, added with 2.2, to have a workaround for this issue.
The text was updated successfully, but these errors were encountered: