-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Slightly less conservative check in isConstraintPosition #46526
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
@typescript-bot test this |
Heya @ahejlsberg, I've started to run the inline community code test suite on this PR at 042debb. You can monitor the build here. Update: The results are in! |
Heya @ahejlsberg, I've started to run the parallelized Definitely Typed test suite on this PR at 042debb. You can monitor the build here. |
Heya @ahejlsberg, I've started to run the extended test suite on this PR at 042debb. You can monitor the build here. |
Heya @ahejlsberg, I've started to run the abridged perf test suite on this PR at 042debb. You can monitor the build here. Update: The results are in! |
@ahejlsberg Here they are:Comparison Report - main..46526
System
Hosts
Scenarios
Developer Information: |
@ahejlsberg |
Tests look good and performance not affected. I think this one is good to go. |
function update<T extends Control, K extends keyof T>(control : T | undefined, key: K, value: T[K]): void { | ||
if (control !== undefined) { | ||
control[key] = value; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can a subsequent else if
discriminate between Button
and Checkbox
, or are we now stuck with T
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In a subsequent else if
the type of control
would be undefined
. But if you mean a subsequent if
inside the block, then yes:
if (control !== undefined) { // Type of control is T | undefined
control[key] = value; // Type of control is T
if (control.type === "button") { // Type of control is Control
control.text; // Type of control is Button
}
}
…6526) * Slight adjustment to check in isConstraintPosition * Add regression test
Fixes #46495.