From 7139079f5cbd7a274e1ca80d114136a0c783a98f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 10 Feb 2026 21:34:56 +0000 Subject: [PATCH 1/3] Initial plan From 92f7e3f22a960c62bb070916882d50c3abead812 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 10 Feb 2026 21:43:00 +0000 Subject: [PATCH 2/3] Port TypeScript PR #61683: use getNonMissingTypeOfSymbol in compareProperties Don't compare "missing" to undefined in compareProperties under exactOptionalPropertyTypes. This changes getTypeOfSymbol to getNonMissingTypeOfSymbol for both source and target properties in the compareProperties function. Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com> --- internal/checker/checker.go | 2 +- ...tOptionalPropertyTypesIdentical.errors.txt | 15 +++++++++++++++ ...onalPropertyTypesIdentical.errors.txt.diff | 19 ------------------- 3 files changed, 16 insertions(+), 20 deletions(-) create mode 100644 testdata/baselines/reference/submodule/compiler/exactOptionalPropertyTypesIdentical.errors.txt delete mode 100644 testdata/baselines/reference/submodule/compiler/exactOptionalPropertyTypesIdentical.errors.txt.diff diff --git a/internal/checker/checker.go b/internal/checker/checker.go index ea6cbfedd09..43bed29e08d 100644 --- a/internal/checker/checker.go +++ b/internal/checker/checker.go @@ -27069,7 +27069,7 @@ func (c *Checker) compareProperties(sourceProp *ast.Symbol, targetProp *ast.Symb if c.isReadonlySymbol(sourceProp) != c.isReadonlySymbol(targetProp) { return TernaryFalse } - return compareTypes(c.getTypeOfSymbol(sourceProp), c.getTypeOfSymbol(targetProp)) + return compareTypes(c.getNonMissingTypeOfSymbol(sourceProp), c.getNonMissingTypeOfSymbol(targetProp)) } func compareTypesEqual(s *Type, t *Type) Ternary { diff --git a/testdata/baselines/reference/submodule/compiler/exactOptionalPropertyTypesIdentical.errors.txt b/testdata/baselines/reference/submodule/compiler/exactOptionalPropertyTypesIdentical.errors.txt new file mode 100644 index 00000000000..8ed639135a1 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/exactOptionalPropertyTypesIdentical.errors.txt @@ -0,0 +1,15 @@ +exactOptionalPropertyTypesIdentical.ts(2,12): error TS2322: Type '() => T extends { a?: string; } ? 0 : 1' is not assignable to type '() => T extends { a?: string | undefined; } ? 0 : 1'. + Type 'T extends { a?: string; } ? 0 : 1' is not assignable to type 'T extends { a?: string | undefined; } ? 0 : 1'. + Type '0 | 1' is not assignable to type 'T extends { a?: string | undefined; } ? 0 : 1'. + Type '0' is not assignable to type 'T extends { a?: string | undefined; } ? 0 : 1'. + + +==== exactOptionalPropertyTypesIdentical.ts (1 errors) ==== + export let a: () => T extends {a?: string} ? 0 : 1 = null!; + export let b: () => T extends {a?: string | undefined} ? 0 : 1 = a; + ~ +!!! error TS2322: Type '() => T extends { a?: string; } ? 0 : 1' is not assignable to type '() => T extends { a?: string | undefined; } ? 0 : 1'. +!!! error TS2322: Type 'T extends { a?: string; } ? 0 : 1' is not assignable to type 'T extends { a?: string | undefined; } ? 0 : 1'. +!!! error TS2322: Type '0 | 1' is not assignable to type 'T extends { a?: string | undefined; } ? 0 : 1'. +!!! error TS2322: Type '0' is not assignable to type 'T extends { a?: string | undefined; } ? 0 : 1'. + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/exactOptionalPropertyTypesIdentical.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/exactOptionalPropertyTypesIdentical.errors.txt.diff deleted file mode 100644 index cd32081c455..00000000000 --- a/testdata/baselines/reference/submodule/compiler/exactOptionalPropertyTypesIdentical.errors.txt.diff +++ /dev/null @@ -1,19 +0,0 @@ ---- old.exactOptionalPropertyTypesIdentical.errors.txt -+++ new.exactOptionalPropertyTypesIdentical.errors.txt -@@= skipped -0, +0 lines =@@ --exactOptionalPropertyTypesIdentical.ts(2,12): error TS2322: Type '() => T extends { a?: string; } ? 0 : 1' is not assignable to type '() => T extends { a?: string | undefined; } ? 0 : 1'. -- Type 'T extends { a?: string; } ? 0 : 1' is not assignable to type 'T extends { a?: string | undefined; } ? 0 : 1'. -- Type '0 | 1' is not assignable to type 'T extends { a?: string | undefined; } ? 0 : 1'. -- Type '0' is not assignable to type 'T extends { a?: string | undefined; } ? 0 : 1'. -- -- --==== exactOptionalPropertyTypesIdentical.ts (1 errors) ==== -- export let a: () => T extends {a?: string} ? 0 : 1 = null!; -- export let b: () => T extends {a?: string | undefined} ? 0 : 1 = a; -- ~ --!!! error TS2322: Type '() => T extends { a?: string; } ? 0 : 1' is not assignable to type '() => T extends { a?: string | undefined; } ? 0 : 1'. --!!! error TS2322: Type 'T extends { a?: string; } ? 0 : 1' is not assignable to type 'T extends { a?: string | undefined; } ? 0 : 1'. --!!! error TS2322: Type '0 | 1' is not assignable to type 'T extends { a?: string | undefined; } ? 0 : 1'. --!!! error TS2322: Type '0' is not assignable to type 'T extends { a?: string | undefined; } ? 0 : 1'. -- -+ \ No newline at end of file From 0683d8597226e32a06d92b859ddb07d0a52295b1 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 10 Feb 2026 22:05:25 +0000 Subject: [PATCH 3/3] Accept all baseline changes for compareProperties fix Accept baseline for multipleBaseInterfaesWithIncompatibleProperties2 with exactoptionalpropertytypes=true, which now correctly reports TS2320 error matching the TypeScript reference. Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com> --- ...xactoptionalpropertytypes=true).errors.txt | 30 ++++++++++++++++ ...ptionalpropertytypes=true).errors.txt.diff | 34 ------------------- 2 files changed, 30 insertions(+), 34 deletions(-) create mode 100644 testdata/baselines/reference/submodule/compiler/multipleBaseInterfaesWithIncompatibleProperties2(exactoptionalpropertytypes=true).errors.txt delete mode 100644 testdata/baselines/reference/submodule/compiler/multipleBaseInterfaesWithIncompatibleProperties2(exactoptionalpropertytypes=true).errors.txt.diff diff --git a/testdata/baselines/reference/submodule/compiler/multipleBaseInterfaesWithIncompatibleProperties2(exactoptionalpropertytypes=true).errors.txt b/testdata/baselines/reference/submodule/compiler/multipleBaseInterfaesWithIncompatibleProperties2(exactoptionalpropertytypes=true).errors.txt new file mode 100644 index 00000000000..6eb7241db27 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/multipleBaseInterfaesWithIncompatibleProperties2(exactoptionalpropertytypes=true).errors.txt @@ -0,0 +1,30 @@ +multipleBaseInterfaesWithIncompatibleProperties2.ts(19,11): error TS2320: Interface 'AgentOptions' cannot simultaneously extend types 'AgentOptions' and 'ConnectionOptions'. + Named property 'port' of types 'AgentOptions' and 'ConnectionOptions' are not identical. + + +==== multipleBaseInterfaesWithIncompatibleProperties2.ts (1 errors) ==== + // https://github.com/microsoft/TypeScript/issues/62569 + + namespace http { + export interface TcpSocketConnectOpts { + port: number; + } + + export interface AgentOptions extends Partial { + keepAlive?: boolean | undefined; + } + } + + namespace tls { + export interface ConnectionOptions { + port?: number | undefined; + } + } + + interface AgentOptions extends http.AgentOptions, tls.ConnectionOptions { // error under exactOptionalPropertyTypes + ~~~~~~~~~~~~ +!!! error TS2320: Interface 'AgentOptions' cannot simultaneously extend types 'AgentOptions' and 'ConnectionOptions'. +!!! error TS2320: Named property 'port' of types 'AgentOptions' and 'ConnectionOptions' are not identical. + maxCachedSessions?: number | undefined; + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/multipleBaseInterfaesWithIncompatibleProperties2(exactoptionalpropertytypes=true).errors.txt.diff b/testdata/baselines/reference/submodule/compiler/multipleBaseInterfaesWithIncompatibleProperties2(exactoptionalpropertytypes=true).errors.txt.diff deleted file mode 100644 index 05cbb59f280..00000000000 --- a/testdata/baselines/reference/submodule/compiler/multipleBaseInterfaesWithIncompatibleProperties2(exactoptionalpropertytypes=true).errors.txt.diff +++ /dev/null @@ -1,34 +0,0 @@ ---- old.multipleBaseInterfaesWithIncompatibleProperties2(exactoptionalpropertytypes=true).errors.txt -+++ new.multipleBaseInterfaesWithIncompatibleProperties2(exactoptionalpropertytypes=true).errors.txt -@@= skipped -0, +0 lines =@@ --multipleBaseInterfaesWithIncompatibleProperties2.ts(19,11): error TS2320: Interface 'AgentOptions' cannot simultaneously extend types 'AgentOptions' and 'ConnectionOptions'. -- Named property 'port' of types 'AgentOptions' and 'ConnectionOptions' are not identical. -- -- --==== multipleBaseInterfaesWithIncompatibleProperties2.ts (1 errors) ==== -- // https://github.com/microsoft/TypeScript/issues/62569 -- -- namespace http { -- export interface TcpSocketConnectOpts { -- port: number; -- } -- -- export interface AgentOptions extends Partial { -- keepAlive?: boolean | undefined; -- } -- } -- -- namespace tls { -- export interface ConnectionOptions { -- port?: number | undefined; -- } -- } -- -- interface AgentOptions extends http.AgentOptions, tls.ConnectionOptions { // error under exactOptionalPropertyTypes -- ~~~~~~~~~~~~ --!!! error TS2320: Interface 'AgentOptions' cannot simultaneously extend types 'AgentOptions' and 'ConnectionOptions'. --!!! error TS2320: Named property 'port' of types 'AgentOptions' and 'ConnectionOptions' are not identical. -- maxCachedSessions?: number | undefined; -- } -- -+ \ No newline at end of file