Handle numeric identifiers

v/1.x.x
Mingwei Samuel 2021-05-30 22:27:06 -07:00
parent ae0ff8745f
commit e7c9595a08
1 changed files with 3 additions and 1 deletions

View File

@ -65,7 +65,9 @@ function normalizeArgName(name) {
}
function normalizePropName(propName) {
const out = changeCase.snakeCase(propName);
let out = changeCase.snakeCase(propName);
if (/^\d/.test(out)) // No leading digits.
out = 'x' + out;
if ('type' === out)
return 'r#' + out;
return out;