diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 0847d1d7829..8dee87d29b6 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -240,7 +240,7 @@ namespace ts { // Make an identifier from an external module name by extracting the string after the last "/" and replacing // all non-alphanumeric characters with underscores export function makeIdentifierFromModuleName(moduleName: string): string { - return getBaseFileName(moduleName).replace(/\W/g, "_"); + return getBaseFileName(moduleName).replace(/^(\d)/, "_$1").replace(/\W/g, "_"); } export function isBlockOrCatchScoped(declaration: Declaration) {