Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tsc/internal/transformers/utilities.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ func convertBindingElementToArrayAssignmentElement(emitContext *printer.EmitCont

func convertBindingElementToObjectAssignmentElement(emitContext *printer.EmitContext, element *ast.BindingElement) *ast.ObjectLiteralElement {
if element.DotDotDotToken != nil {
spread := emitContext.Factory.NewSpreadAssignment(element.Name())
spread := emitContext.Factory.NewSpreadAssignment(convertBindingNameToAssignmentElementTarget(emitContext, element.Name()))
emitContext.SetOriginal(spread, element.AsNode())
emitContext.AssignCommentAndSourceMapRanges(spread, element.AsNode())
return spread
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
commonjsExportNestedRestBinding.ts(2,18): error TS1003: Identifier expected.


==== commonjsExportNestedRestBinding.ts (1 errors) ====
declare const source: any;
export const {...{object}} = source;
~
!!! error TS1003: Identifier expected.

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//// [tests/cases/compiler/commonjsExportNestedRestBinding.ts] ////

//// [commonjsExportNestedRestBinding.ts]
declare const source: any;
export const {...{object}} = source;


//// [commonjsExportNestedRestBinding.js]
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.object = void 0;
({ ...{ object: exports.object } } = source);
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
//// [tests/cases/compiler/commonjsExportNestedRestBinding.ts] ////

=== commonjsExportNestedRestBinding.ts ===
declare const source: any;
>source : Symbol(source, Decl(commonjsExportNestedRestBinding.ts, 0, 13))

export const {...{object}} = source;
>object : Symbol(object, Decl(commonjsExportNestedRestBinding.ts, 1, 18))
>source : Symbol(source, Decl(commonjsExportNestedRestBinding.ts, 0, 13))

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
//// [tests/cases/compiler/commonjsExportNestedRestBinding.ts] ////

=== commonjsExportNestedRestBinding.ts ===
declare const source: any;
>source : any

export const {...{object}} = source;
> : any
>object : any
>source : any

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
commonjsExportNestedRestBinding.ts(2,18): error TS1003: Identifier expected.


==== commonjsExportNestedRestBinding.ts (1 errors) ====
declare const source: any;
export const {...{object}} = source;
~
!!! error TS1003: Identifier expected.

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//// [tests/cases/compiler/commonjsExportNestedRestBinding.ts] ////

//// [commonjsExportNestedRestBinding.ts]
declare const source: any;
export const {...{object}} = source;


//// [commonjsExportNestedRestBinding.js]
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.object = void 0;
({ ...{ object: exports.object } } = source);
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
//// [tests/cases/compiler/commonjsExportNestedRestBinding.ts] ////

=== commonjsExportNestedRestBinding.ts ===
declare const source: any;
>source : Symbol(source, Decl(commonjsExportNestedRestBinding.ts, 0, 13))

export const {...{object}} = source;
>object : Symbol(object, Decl(commonjsExportNestedRestBinding.ts, 1, 18))
>source : Symbol(source, Decl(commonjsExportNestedRestBinding.ts, 0, 13))

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
//// [tests/cases/compiler/commonjsExportNestedRestBinding.ts] ////

=== commonjsExportNestedRestBinding.ts ===
declare const source: any;
>source : any

export const {...{object}} = source;
> : any
>object : any
>source : any

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// @target: es2018, esnext
// @module: commonjs

declare const source: any;
export const {...{object}} = source;
Loading