ts generator: allow reserved keywords in interfaces (#8627)
This commit is contained in:
parent
0e7d7cfccc
commit
252660f248
@ -81,8 +81,12 @@ for (const type in t.NODE_FIELDS) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (t.isValidIdentifier(fieldName)) {
|
const alphaNumeric = /^\w+$/;
|
||||||
|
|
||||||
|
if (t.isValidIdentifier(fieldName) || alphaNumeric.test(fieldName)) {
|
||||||
struct.push(`${fieldName}: ${typeAnnotation};`);
|
struct.push(`${fieldName}: ${typeAnnotation};`);
|
||||||
|
} else {
|
||||||
|
struct.push(`"${fieldName}": ${typeAnnotation};`);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user