-
Notifications
You must be signed in to change notification settings - Fork 12.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🤖 Pick PR #59208 (Write non-missing undefined on mapp...) into releas…
…e-5.5 (#59230) Co-authored-by: Wesley Wigham <[email protected]> Co-authored-by: Jake Bailey <[email protected]>
- Loading branch information
1 parent
b075332
commit 5ba41e2
Showing
13 changed files
with
370 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
...clarationEmitExactOptionalPropertyTypesNodeNotReused(exactoptionalpropertytypes=false).js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
//// [tests/cases/compiler/declarationEmitExactOptionalPropertyTypesNodeNotReused.ts] //// | ||
|
||
//// [declarationEmitExactOptionalPropertyTypesNodeNotReused.ts] | ||
type InexactOptionals<A> = { | ||
[K in keyof A as undefined extends A[K] ? K : never]?: undefined extends A[K] | ||
? A[K] | undefined | ||
: A[K]; | ||
} & { | ||
[K in keyof A as undefined extends A[K] ? never : K]: A[K]; | ||
}; | ||
|
||
type In = { | ||
foo?: string; | ||
bar: number; | ||
baz: undefined; | ||
} | ||
|
||
type Out = InexactOptionals<In> | ||
|
||
const foo = <A = {}>() => (x: Out & A) => null | ||
|
||
export const baddts = foo() | ||
|
||
|
||
//// [declarationEmitExactOptionalPropertyTypesNodeNotReused.js] | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.baddts = void 0; | ||
var foo = function () { return function (x) { return null; }; }; | ||
exports.baddts = foo(); | ||
|
||
|
||
//// [declarationEmitExactOptionalPropertyTypesNodeNotReused.d.ts] | ||
export declare const baddts: (x: { | ||
foo?: string | undefined; | ||
baz?: undefined; | ||
} & { | ||
bar: number; | ||
}) => null; |
65 changes: 65 additions & 0 deletions
65
...tionEmitExactOptionalPropertyTypesNodeNotReused(exactoptionalpropertytypes=false).symbols
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
//// [tests/cases/compiler/declarationEmitExactOptionalPropertyTypesNodeNotReused.ts] //// | ||
|
||
=== declarationEmitExactOptionalPropertyTypesNodeNotReused.ts === | ||
type InexactOptionals<A> = { | ||
>InexactOptionals : Symbol(InexactOptionals, Decl(declarationEmitExactOptionalPropertyTypesNodeNotReused.ts, 0, 0)) | ||
>A : Symbol(A, Decl(declarationEmitExactOptionalPropertyTypesNodeNotReused.ts, 0, 22)) | ||
|
||
[K in keyof A as undefined extends A[K] ? K : never]?: undefined extends A[K] | ||
>K : Symbol(K, Decl(declarationEmitExactOptionalPropertyTypesNodeNotReused.ts, 1, 5)) | ||
>A : Symbol(A, Decl(declarationEmitExactOptionalPropertyTypesNodeNotReused.ts, 0, 22)) | ||
>A : Symbol(A, Decl(declarationEmitExactOptionalPropertyTypesNodeNotReused.ts, 0, 22)) | ||
>K : Symbol(K, Decl(declarationEmitExactOptionalPropertyTypesNodeNotReused.ts, 1, 5)) | ||
>K : Symbol(K, Decl(declarationEmitExactOptionalPropertyTypesNodeNotReused.ts, 1, 5)) | ||
>A : Symbol(A, Decl(declarationEmitExactOptionalPropertyTypesNodeNotReused.ts, 0, 22)) | ||
>K : Symbol(K, Decl(declarationEmitExactOptionalPropertyTypesNodeNotReused.ts, 1, 5)) | ||
|
||
? A[K] | undefined | ||
>A : Symbol(A, Decl(declarationEmitExactOptionalPropertyTypesNodeNotReused.ts, 0, 22)) | ||
>K : Symbol(K, Decl(declarationEmitExactOptionalPropertyTypesNodeNotReused.ts, 1, 5)) | ||
|
||
: A[K]; | ||
>A : Symbol(A, Decl(declarationEmitExactOptionalPropertyTypesNodeNotReused.ts, 0, 22)) | ||
>K : Symbol(K, Decl(declarationEmitExactOptionalPropertyTypesNodeNotReused.ts, 1, 5)) | ||
|
||
} & { | ||
[K in keyof A as undefined extends A[K] ? never : K]: A[K]; | ||
>K : Symbol(K, Decl(declarationEmitExactOptionalPropertyTypesNodeNotReused.ts, 5, 5)) | ||
>A : Symbol(A, Decl(declarationEmitExactOptionalPropertyTypesNodeNotReused.ts, 0, 22)) | ||
>A : Symbol(A, Decl(declarationEmitExactOptionalPropertyTypesNodeNotReused.ts, 0, 22)) | ||
>K : Symbol(K, Decl(declarationEmitExactOptionalPropertyTypesNodeNotReused.ts, 5, 5)) | ||
>K : Symbol(K, Decl(declarationEmitExactOptionalPropertyTypesNodeNotReused.ts, 5, 5)) | ||
>A : Symbol(A, Decl(declarationEmitExactOptionalPropertyTypesNodeNotReused.ts, 0, 22)) | ||
>K : Symbol(K, Decl(declarationEmitExactOptionalPropertyTypesNodeNotReused.ts, 5, 5)) | ||
|
||
}; | ||
|
||
type In = { | ||
>In : Symbol(In, Decl(declarationEmitExactOptionalPropertyTypesNodeNotReused.ts, 6, 2)) | ||
|
||
foo?: string; | ||
>foo : Symbol(foo, Decl(declarationEmitExactOptionalPropertyTypesNodeNotReused.ts, 8, 11)) | ||
|
||
bar: number; | ||
>bar : Symbol(bar, Decl(declarationEmitExactOptionalPropertyTypesNodeNotReused.ts, 9, 17)) | ||
|
||
baz: undefined; | ||
>baz : Symbol(baz, Decl(declarationEmitExactOptionalPropertyTypesNodeNotReused.ts, 10, 16)) | ||
} | ||
|
||
type Out = InexactOptionals<In> | ||
>Out : Symbol(Out, Decl(declarationEmitExactOptionalPropertyTypesNodeNotReused.ts, 12, 1)) | ||
>InexactOptionals : Symbol(InexactOptionals, Decl(declarationEmitExactOptionalPropertyTypesNodeNotReused.ts, 0, 0)) | ||
>In : Symbol(In, Decl(declarationEmitExactOptionalPropertyTypesNodeNotReused.ts, 6, 2)) | ||
|
||
const foo = <A = {}>() => (x: Out & A) => null | ||
>foo : Symbol(foo, Decl(declarationEmitExactOptionalPropertyTypesNodeNotReused.ts, 16, 5)) | ||
>A : Symbol(A, Decl(declarationEmitExactOptionalPropertyTypesNodeNotReused.ts, 16, 13)) | ||
>x : Symbol(x, Decl(declarationEmitExactOptionalPropertyTypesNodeNotReused.ts, 16, 27)) | ||
>Out : Symbol(Out, Decl(declarationEmitExactOptionalPropertyTypesNodeNotReused.ts, 12, 1)) | ||
>A : Symbol(A, Decl(declarationEmitExactOptionalPropertyTypesNodeNotReused.ts, 16, 13)) | ||
|
||
export const baddts = foo() | ||
>baddts : Symbol(baddts, Decl(declarationEmitExactOptionalPropertyTypesNodeNotReused.ts, 18, 12)) | ||
>foo : Symbol(foo, Decl(declarationEmitExactOptionalPropertyTypesNodeNotReused.ts, 16, 5)) | ||
|
53 changes: 53 additions & 0 deletions
53
...rationEmitExactOptionalPropertyTypesNodeNotReused(exactoptionalpropertytypes=false).types
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
//// [tests/cases/compiler/declarationEmitExactOptionalPropertyTypesNodeNotReused.ts] //// | ||
|
||
=== declarationEmitExactOptionalPropertyTypesNodeNotReused.ts === | ||
type InexactOptionals<A> = { | ||
>InexactOptionals : InexactOptionals<A> | ||
> : ^^^^^^^^^^^^^^^^^^^ | ||
|
||
[K in keyof A as undefined extends A[K] ? K : never]?: undefined extends A[K] | ||
? A[K] | undefined | ||
: A[K]; | ||
} & { | ||
[K in keyof A as undefined extends A[K] ? never : K]: A[K]; | ||
}; | ||
|
||
type In = { | ||
>In : In | ||
> : ^^ | ||
|
||
foo?: string; | ||
>foo : string | undefined | ||
> : ^^^^^^^^^^^^^^^^^^ | ||
|
||
bar: number; | ||
>bar : number | ||
> : ^^^^^^ | ||
|
||
baz: undefined; | ||
>baz : undefined | ||
> : ^^^^^^^^^ | ||
} | ||
|
||
type Out = InexactOptionals<In> | ||
>Out : Out | ||
> : ^^^ | ||
|
||
const foo = <A = {}>() => (x: Out & A) => null | ||
>foo : <A = {}>() => (x: Out & A) => null | ||
> : ^ ^^^^^^^^^^^^^ ^^ ^^^^^^^^^ | ||
><A = {}>() => (x: Out & A) => null : <A = {}>() => (x: Out & A) => null | ||
> : ^ ^^^^^^^^^^^^^ ^^ ^^^^^^^^^ | ||
>(x: Out & A) => null : (x: Out & A) => null | ||
> : ^ ^^ ^^^^^^^^^ | ||
>x : { foo?: string | undefined; baz?: undefined; } & { bar: number; } & A | ||
> : ^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^ ^^^^^^^ | ||
|
||
export const baddts = foo() | ||
>baddts : (x: { foo?: string | undefined; baz?: undefined; } & { bar: number; }) => null | ||
> : ^ ^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^ ^^^^^^^^^^^^ | ||
>foo() : (x: { foo?: string | undefined; baz?: undefined; } & { bar: number; }) => null | ||
> : ^ ^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^ ^^^^^^^^^^^^ | ||
>foo : <A = {}>() => (x: Out & A) => null | ||
> : ^ ^^^^^^^^^^^^^ ^^ ^^^^^^^^^ | ||
|
39 changes: 39 additions & 0 deletions
39
...eclarationEmitExactOptionalPropertyTypesNodeNotReused(exactoptionalpropertytypes=true).js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
//// [tests/cases/compiler/declarationEmitExactOptionalPropertyTypesNodeNotReused.ts] //// | ||
|
||
//// [declarationEmitExactOptionalPropertyTypesNodeNotReused.ts] | ||
type InexactOptionals<A> = { | ||
[K in keyof A as undefined extends A[K] ? K : never]?: undefined extends A[K] | ||
? A[K] | undefined | ||
: A[K]; | ||
} & { | ||
[K in keyof A as undefined extends A[K] ? never : K]: A[K]; | ||
}; | ||
|
||
type In = { | ||
foo?: string; | ||
bar: number; | ||
baz: undefined; | ||
} | ||
|
||
type Out = InexactOptionals<In> | ||
|
||
const foo = <A = {}>() => (x: Out & A) => null | ||
|
||
export const baddts = foo() | ||
|
||
|
||
//// [declarationEmitExactOptionalPropertyTypesNodeNotReused.js] | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.baddts = void 0; | ||
var foo = function () { return function (x) { return null; }; }; | ||
exports.baddts = foo(); | ||
|
||
|
||
//// [declarationEmitExactOptionalPropertyTypesNodeNotReused.d.ts] | ||
export declare const baddts: (x: { | ||
foo?: string | undefined; | ||
baz?: undefined; | ||
} & { | ||
bar: number; | ||
}) => null; |
65 changes: 65 additions & 0 deletions
65
...ationEmitExactOptionalPropertyTypesNodeNotReused(exactoptionalpropertytypes=true).symbols
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
//// [tests/cases/compiler/declarationEmitExactOptionalPropertyTypesNodeNotReused.ts] //// | ||
|
||
=== declarationEmitExactOptionalPropertyTypesNodeNotReused.ts === | ||
type InexactOptionals<A> = { | ||
>InexactOptionals : Symbol(InexactOptionals, Decl(declarationEmitExactOptionalPropertyTypesNodeNotReused.ts, 0, 0)) | ||
>A : Symbol(A, Decl(declarationEmitExactOptionalPropertyTypesNodeNotReused.ts, 0, 22)) | ||
|
||
[K in keyof A as undefined extends A[K] ? K : never]?: undefined extends A[K] | ||
>K : Symbol(K, Decl(declarationEmitExactOptionalPropertyTypesNodeNotReused.ts, 1, 5)) | ||
>A : Symbol(A, Decl(declarationEmitExactOptionalPropertyTypesNodeNotReused.ts, 0, 22)) | ||
>A : Symbol(A, Decl(declarationEmitExactOptionalPropertyTypesNodeNotReused.ts, 0, 22)) | ||
>K : Symbol(K, Decl(declarationEmitExactOptionalPropertyTypesNodeNotReused.ts, 1, 5)) | ||
>K : Symbol(K, Decl(declarationEmitExactOptionalPropertyTypesNodeNotReused.ts, 1, 5)) | ||
>A : Symbol(A, Decl(declarationEmitExactOptionalPropertyTypesNodeNotReused.ts, 0, 22)) | ||
>K : Symbol(K, Decl(declarationEmitExactOptionalPropertyTypesNodeNotReused.ts, 1, 5)) | ||
|
||
? A[K] | undefined | ||
>A : Symbol(A, Decl(declarationEmitExactOptionalPropertyTypesNodeNotReused.ts, 0, 22)) | ||
>K : Symbol(K, Decl(declarationEmitExactOptionalPropertyTypesNodeNotReused.ts, 1, 5)) | ||
|
||
: A[K]; | ||
>A : Symbol(A, Decl(declarationEmitExactOptionalPropertyTypesNodeNotReused.ts, 0, 22)) | ||
>K : Symbol(K, Decl(declarationEmitExactOptionalPropertyTypesNodeNotReused.ts, 1, 5)) | ||
|
||
} & { | ||
[K in keyof A as undefined extends A[K] ? never : K]: A[K]; | ||
>K : Symbol(K, Decl(declarationEmitExactOptionalPropertyTypesNodeNotReused.ts, 5, 5)) | ||
>A : Symbol(A, Decl(declarationEmitExactOptionalPropertyTypesNodeNotReused.ts, 0, 22)) | ||
>A : Symbol(A, Decl(declarationEmitExactOptionalPropertyTypesNodeNotReused.ts, 0, 22)) | ||
>K : Symbol(K, Decl(declarationEmitExactOptionalPropertyTypesNodeNotReused.ts, 5, 5)) | ||
>K : Symbol(K, Decl(declarationEmitExactOptionalPropertyTypesNodeNotReused.ts, 5, 5)) | ||
>A : Symbol(A, Decl(declarationEmitExactOptionalPropertyTypesNodeNotReused.ts, 0, 22)) | ||
>K : Symbol(K, Decl(declarationEmitExactOptionalPropertyTypesNodeNotReused.ts, 5, 5)) | ||
|
||
}; | ||
|
||
type In = { | ||
>In : Symbol(In, Decl(declarationEmitExactOptionalPropertyTypesNodeNotReused.ts, 6, 2)) | ||
|
||
foo?: string; | ||
>foo : Symbol(foo, Decl(declarationEmitExactOptionalPropertyTypesNodeNotReused.ts, 8, 11)) | ||
|
||
bar: number; | ||
>bar : Symbol(bar, Decl(declarationEmitExactOptionalPropertyTypesNodeNotReused.ts, 9, 17)) | ||
|
||
baz: undefined; | ||
>baz : Symbol(baz, Decl(declarationEmitExactOptionalPropertyTypesNodeNotReused.ts, 10, 16)) | ||
} | ||
|
||
type Out = InexactOptionals<In> | ||
>Out : Symbol(Out, Decl(declarationEmitExactOptionalPropertyTypesNodeNotReused.ts, 12, 1)) | ||
>InexactOptionals : Symbol(InexactOptionals, Decl(declarationEmitExactOptionalPropertyTypesNodeNotReused.ts, 0, 0)) | ||
>In : Symbol(In, Decl(declarationEmitExactOptionalPropertyTypesNodeNotReused.ts, 6, 2)) | ||
|
||
const foo = <A = {}>() => (x: Out & A) => null | ||
>foo : Symbol(foo, Decl(declarationEmitExactOptionalPropertyTypesNodeNotReused.ts, 16, 5)) | ||
>A : Symbol(A, Decl(declarationEmitExactOptionalPropertyTypesNodeNotReused.ts, 16, 13)) | ||
>x : Symbol(x, Decl(declarationEmitExactOptionalPropertyTypesNodeNotReused.ts, 16, 27)) | ||
>Out : Symbol(Out, Decl(declarationEmitExactOptionalPropertyTypesNodeNotReused.ts, 12, 1)) | ||
>A : Symbol(A, Decl(declarationEmitExactOptionalPropertyTypesNodeNotReused.ts, 16, 13)) | ||
|
||
export const baddts = foo() | ||
>baddts : Symbol(baddts, Decl(declarationEmitExactOptionalPropertyTypesNodeNotReused.ts, 18, 12)) | ||
>foo : Symbol(foo, Decl(declarationEmitExactOptionalPropertyTypesNodeNotReused.ts, 16, 5)) | ||
|
53 changes: 53 additions & 0 deletions
53
...arationEmitExactOptionalPropertyTypesNodeNotReused(exactoptionalpropertytypes=true).types
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
//// [tests/cases/compiler/declarationEmitExactOptionalPropertyTypesNodeNotReused.ts] //// | ||
|
||
=== declarationEmitExactOptionalPropertyTypesNodeNotReused.ts === | ||
type InexactOptionals<A> = { | ||
>InexactOptionals : InexactOptionals<A> | ||
> : ^^^^^^^^^^^^^^^^^^^ | ||
|
||
[K in keyof A as undefined extends A[K] ? K : never]?: undefined extends A[K] | ||
? A[K] | undefined | ||
: A[K]; | ||
} & { | ||
[K in keyof A as undefined extends A[K] ? never : K]: A[K]; | ||
}; | ||
|
||
type In = { | ||
>In : In | ||
> : ^^ | ||
|
||
foo?: string; | ||
>foo : string | undefined | ||
> : ^^^^^^^^^^^^^^^^^^ | ||
|
||
bar: number; | ||
>bar : number | ||
> : ^^^^^^ | ||
|
||
baz: undefined; | ||
>baz : undefined | ||
> : ^^^^^^^^^ | ||
} | ||
|
||
type Out = InexactOptionals<In> | ||
>Out : Out | ||
> : ^^^ | ||
|
||
const foo = <A = {}>() => (x: Out & A) => null | ||
>foo : <A = {}>() => (x: Out & A) => null | ||
> : ^ ^^^^^^^^^^^^^ ^^ ^^^^^^^^^ | ||
><A = {}>() => (x: Out & A) => null : <A = {}>() => (x: Out & A) => null | ||
> : ^ ^^^^^^^^^^^^^ ^^ ^^^^^^^^^ | ||
>(x: Out & A) => null : (x: Out & A) => null | ||
> : ^ ^^ ^^^^^^^^^ | ||
>x : { foo?: string | undefined; baz?: undefined; } & { bar: number; } & A | ||
> : ^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^ ^^^^^^^ | ||
|
||
export const baddts = foo() | ||
>baddts : (x: { foo?: string | undefined; baz?: undefined; } & { bar: number; }) => null | ||
> : ^ ^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^ ^^^^^^^^^^^^ | ||
>foo() : (x: { foo?: string | undefined; baz?: undefined; } & { bar: number; }) => null | ||
> : ^ ^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^ ^^^^^^^^^^^^ | ||
>foo : <A = {}>() => (x: Out & A) => null | ||
> : ^ ^^^^^^^^^^^^^ ^^ ^^^^^^^^^ | ||
|
Oops, something went wrong.