-
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.
- Loading branch information
1 parent
a3bac96
commit 26df65a
Showing
4 changed files
with
106 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
//// [nonPrimitiveAndEmptyObject.ts] | ||
// Repro from #49480 | ||
|
||
export interface BarProps { | ||
barProp?: string; | ||
} | ||
|
||
export interface FooProps { | ||
fooProps?: BarProps & object; | ||
} | ||
|
||
declare const foo: FooProps; | ||
const { fooProps = {} } = foo; | ||
|
||
fooProps.barProp; | ||
|
||
|
||
//// [nonPrimitiveAndEmptyObject.js] | ||
"use strict"; | ||
// Repro from #49480 | ||
exports.__esModule = true; | ||
var _a = foo.fooProps, fooProps = _a === void 0 ? {} : _a; | ||
fooProps.barProp; | ||
|
||
|
||
//// [nonPrimitiveAndEmptyObject.d.ts] | ||
export interface BarProps { | ||
barProp?: string; | ||
} | ||
export interface FooProps { | ||
fooProps?: BarProps & object; | ||
} |
31 changes: 31 additions & 0 deletions
31
tests/baselines/reference/nonPrimitiveAndEmptyObject.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,31 @@ | ||
=== tests/cases/conformance/types/nonPrimitive/nonPrimitiveAndEmptyObject.ts === | ||
// Repro from #49480 | ||
|
||
export interface BarProps { | ||
>BarProps : Symbol(BarProps, Decl(nonPrimitiveAndEmptyObject.ts, 0, 0)) | ||
|
||
barProp?: string; | ||
>barProp : Symbol(BarProps.barProp, Decl(nonPrimitiveAndEmptyObject.ts, 2, 27)) | ||
} | ||
|
||
export interface FooProps { | ||
>FooProps : Symbol(FooProps, Decl(nonPrimitiveAndEmptyObject.ts, 4, 1)) | ||
|
||
fooProps?: BarProps & object; | ||
>fooProps : Symbol(FooProps.fooProps, Decl(nonPrimitiveAndEmptyObject.ts, 6, 27)) | ||
>BarProps : Symbol(BarProps, Decl(nonPrimitiveAndEmptyObject.ts, 0, 0)) | ||
} | ||
|
||
declare const foo: FooProps; | ||
>foo : Symbol(foo, Decl(nonPrimitiveAndEmptyObject.ts, 10, 13)) | ||
>FooProps : Symbol(FooProps, Decl(nonPrimitiveAndEmptyObject.ts, 4, 1)) | ||
|
||
const { fooProps = {} } = foo; | ||
>fooProps : Symbol(fooProps, Decl(nonPrimitiveAndEmptyObject.ts, 11, 7)) | ||
>foo : Symbol(foo, Decl(nonPrimitiveAndEmptyObject.ts, 10, 13)) | ||
|
||
fooProps.barProp; | ||
>fooProps.barProp : Symbol(BarProps.barProp, Decl(nonPrimitiveAndEmptyObject.ts, 2, 27)) | ||
>fooProps : Symbol(fooProps, Decl(nonPrimitiveAndEmptyObject.ts, 11, 7)) | ||
>barProp : Symbol(BarProps.barProp, Decl(nonPrimitiveAndEmptyObject.ts, 2, 27)) | ||
|
26 changes: 26 additions & 0 deletions
26
tests/baselines/reference/nonPrimitiveAndEmptyObject.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,26 @@ | ||
=== tests/cases/conformance/types/nonPrimitive/nonPrimitiveAndEmptyObject.ts === | ||
// Repro from #49480 | ||
|
||
export interface BarProps { | ||
barProp?: string; | ||
>barProp : string | undefined | ||
} | ||
|
||
export interface FooProps { | ||
fooProps?: BarProps & object; | ||
>fooProps : (BarProps & object) | undefined | ||
} | ||
|
||
declare const foo: FooProps; | ||
>foo : FooProps | ||
|
||
const { fooProps = {} } = foo; | ||
>fooProps : BarProps & object | ||
>{} : {} | ||
>foo : FooProps | ||
|
||
fooProps.barProp; | ||
>fooProps.barProp : string | undefined | ||
>fooProps : BarProps & object | ||
>barProp : string | undefined | ||
|
17 changes: 17 additions & 0 deletions
17
tests/cases/conformance/types/nonPrimitive/nonPrimitiveAndEmptyObject.ts
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,17 @@ | ||
// @strict: true | ||
// @declaration: true | ||
|
||
// Repro from #49480 | ||
|
||
export interface BarProps { | ||
barProp?: string; | ||
} | ||
|
||
export interface FooProps { | ||
fooProps?: BarProps & object; | ||
} | ||
|
||
declare const foo: FooProps; | ||
const { fooProps = {} } = foo; | ||
|
||
fooProps.barProp; |