diff --git a/src/typeGenerator.ts b/src/typeGenerator.ts index 4d97407..2c01f26 100644 --- a/src/typeGenerator.ts +++ b/src/typeGenerator.ts @@ -11,7 +11,7 @@ type _ExclusiveUnion = type OneOf = _ExclusiveUnion>` const capFirst = (str: string) => str[0].toUpperCase() + str.slice(1) -const jsonKey = (str: string) => str.match('\\W') ? `'${str}'` : str +const jsonKey = (str: string) => str.match(/\W/g) ? `'${str}'` : str const refRe = /(\w+)(?:\.\w+)?#(?:\/(\w+))+/ function simplestType (schema: Schema, interfaceName: string, stack: Stack): string {