Skip to content

babel-parser: missing errors on assignment pattern in object expression #10262

@jaejun-choi

Description

@jaejun-choi

Bug Report

Current Behavior
Does not throw errors

Input Code
Bug

var obj = {
  foo = 123, // no error
  bar: x = 123
};

Works fine

var obj = {
  foo = 123 // SyntaxError: Unexpected token
};

Expected behavior/code
Should throw errors.
Chrome
SyntaxError: Invalid shorthand property initializer
TypeScript
error TS1312: '=' can only be used in an object literal property inside a destructuring assignment.

Environment
Babel version(s): 7.5.5
Node/npm version: Node 11.13 / npm 6.7

Metadata

Metadata

Assignees

Labels

claimedoutdatedA closed issue/PR that is archived due to age. Recommended to make a new issuepkg: parser

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions