Copy "optional" property when cloning Identifier node (#9333)
Fixes #9331
This commit is contained in:
parent
0a88230ec4
commit
e9588061d7
@ -38,6 +38,10 @@ export default function cloneNode<T: Object>(node: T, deep: boolean = true): T {
|
||||
if (type === "Identifier") {
|
||||
newNode.name = node.name;
|
||||
|
||||
if (has(node, "optional") && typeof node.optional === "boolean") {
|
||||
newNode.optional = node.optional;
|
||||
}
|
||||
|
||||
if (has(node, "typeAnnotation")) {
|
||||
newNode.typeAnnotation = deep
|
||||
? cloneIfNodeOrArray(node.typeAnnotation, true)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user