Widen types assigned to auto-typed variables#3497
Widen types assigned to auto-typed variables#3497Andarist wants to merge 3 commits intomicrosoft:mainfrom
Conversation
|
@typescript-bot test it |
|
@ahejlsberg Here they are:
tscComparison Report - baseline..pr
System info unknown
Hosts
Scenarios
Developer Information: |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
@ahejlsberg Here are the results of running the user tests with tsc comparing There were infrastructure failures potentially unrelated to your change:
Otherwise... Something interesting changed - please have a look. Details
|
|
@ahejlsberg Here are the results of running the top 400 repos with tsc comparing Something interesting changed - please have a look. Details
|
|
Looks like we're fine on perf, but wondering what the changes in user tests and top 400 are about? |
|
This one makes But if we strip the fact this has a mix of different sources for the And we can further demo the difference between the subtype reduction rules here (TS playground): /** @typedef {string | number | boolean} CodeValue */
/**
* @param {Record<string, CodeValue>} arg
*/
function test(arg) {
const obj = {};
const result1 = Math.random() ? arg : obj
// ^? const result1: {}
const result2 = Math.random() ? arg : {}
// ^? const result2: Record<string, CodeValue>
}The original webpack break is really close to the This one is weird. I didn't yet have the time to debug why this has changed. However, we can clearly see that So overall, I think both breaks are expected. I'll push relevant tests to this PR later. |
|
New tests are in now. |
fixes #3491