diff --git a/src/index.ts b/src/index.ts index 5cab2fc..f37b674 100644 --- a/src/index.ts +++ b/src/index.ts @@ -628,6 +628,6 @@ function isNameSafe(name: string) { } function isNextNameSafe(token: Token | undefined) { - if (token?.type !== "text") return true; + if (!token || token.type !== "text") return true; return !ID_CONTINUE.test(token.value[0]); }