fix(build): fix const enum w/ number values

This commit is contained in:
Evan You 2023-02-06 14:03:15 +08:00
parent 097f6beca2
commit 92bb189ca7
1 changed files with 2 additions and 3 deletions

View File

@ -149,10 +149,9 @@ export function scanEnums() {
} else { } else {
if (lastInitialized === undefined) { if (lastInitialized === undefined) {
// first initialized // first initialized
saveValue(`0`) saveValue((lastInitialized = 0))
lastInitialized = 0
} else if (typeof lastInitialized === 'number') { } else if (typeof lastInitialized === 'number') {
saveValue(String(++lastInitialized)) saveValue(++lastInitialized)
} else { } else {
// should not happen // should not happen
throw new Error(`wrong enum initialization sequence in ${file}`) throw new Error(`wrong enum initialization sequence in ${file}`)