A shorthand assignment is when an object literal is created without explicitly writing the property name using the name: expression syntax.
An example:
var title = "hello world";
var author = "Foo Bar";
var obj = { title, author };
is the same as writing
var obj = {title: title, author: author};
We would like to desugar this ourselves when we are in the visit step. If we see a node with SyntaxKind.ShorthandPropertyAssignment, rewrite the identifier like so, and check if the name of the property can be renamed.
A shorthand assignment is when an object literal is created without explicitly writing the property name using the
name: expression
syntax.An example:
We would like to desugar this ourselves when we are in the visit step. If we see a node with
SyntaxKind.ShorthandPropertyAssignment
, rewrite the identifier like so, and check if the name of the property can be renamed.property_name_identifier: expression_being_assigned
Difficulty: Between
easy
andmedium