-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Closed
Labels
Design LimitationConstraints of the existing architecture prevent this from being fixedConstraints of the existing architecture prevent this from being fixed
Description
TypeScript Version: 2.2
Code
interface ComponentState {
a: string;
b: number;
c: boolean;
}
const setState = (state: Partial<ComponentState>) => {
....
}
setState(1)
setState("1")
setState(true)
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.
Metadata
Metadata
Assignees
Labels
Design LimitationConstraints of the existing architecture prevent this from being fixedConstraints of the existing architecture prevent this from being fixed