Port https://github.com/microsoft/typescript-go/pull/1759#62502
Port https://github.com/microsoft/typescript-go/pull/1759#62502ahejlsberg merged 2 commits intomainfrom
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR ports changes from typescript-go repository pull request #1759, focusing on improving type checking behavior for object literal types and updating test baselines accordingly.
- Updates type checking logic for fresh literal types to use object flags instead of type checking
- Removes redundant undefined type checking for source properties
- Updates test baseline to reflect more precise type information
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/compiler/checker.ts | Refactors object literal type checking to use ObjectFlags.FreshLiteral and removes unnecessary undefined checking |
| tests/baselines/reference/jsDeclarationsFunctionClassesCjsExportAssignment.js | Updates baseline to show State type instead of any for the state property |
Comments suppressed due to low confidence (1)
src/compiler/checker.ts:1
- The removal of the undefined type check may cause incorrect behavior. Previously, properties with undefined types were allowed to not exist on the target type, but now all source properties must exist on the target regardless of their type. This could break valid TypeScript code where optional properties are involved.
import {
|
Not sure why the .d.ts emit changed, though looks it actually improved. |
|
@typescript-bot test it |
|
Hey @ahejlsberg, the results of running the DT tests are ready. Everything looks the same! |
|
@ahejlsberg Here are the results of running the user tests with tsc comparing There were infrastructure failures potentially unrelated to your change:
Otherwise... Everything looks good! |
|
@ahejlsberg Here they are:
tscComparison Report - baseline..pr
System info unknown
Hosts
Scenarios
Developer Information: |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
@ahejlsberg Here are the results of running the top 400 repos with tsc comparing Everything looks good! |
|
Looks like Strada’s code is already being back-ported to Corsa. Interesting. |
Ports microsoft/typescript-go#1759.