diff --git a/src/quicktype-core/language/JavaScript.ts b/src/quicktype-core/language/JavaScript.ts index 76ca625c..87bc2ceb 100644 --- a/src/quicktype-core/language/JavaScript.ts +++ b/src/quicktype-core/language/JavaScript.ts @@ -242,7 +242,11 @@ export class JavaScriptRenderer extends ConvenienceRenderer { this.ensureBlankLine(); this.emitBlock([this.serializerFunctionLine(t, name), " "], "", () => { - this.emitLine("return JSON.stringify(uncast(value, ", typeMap, "), null, 2);"); + if (!this._jsOptions.runtimeTypecheck) { + this.emitLine("return JSON.stringify(value);"); + } else { + this.emitLine("return JSON.stringify(uncast(value, ", typeMap, "), null, 2);"); + } }); }); if (this._jsOptions.runtimeTypecheck) { diff --git a/test/languages.ts b/test/languages.ts index 64e34a01..328283a5 100644 --- a/test/languages.ts +++ b/test/languages.ts @@ -524,7 +524,11 @@ export const TypeScriptLanguage: Language = { skipMiscJSON: false, skipSchema: ["keyword-unions.schema"], // can't handle "constructor" property rendererOptions: { "explicit-unions": "yes" }, - quickTestRendererOptions: [{ "nice-property-names": "true" }, { "declare-unions": "true" }], + quickTestRendererOptions: [ + { "runtime-typecheck": "false" }, + { "nice-property-names": "true" }, + { "declare-unions": "true" } + ], sourceFiles: ["src/language/TypeScript.ts"] }; @@ -545,7 +549,7 @@ export const JavaScriptLanguage: Language = { skipMiscJSON: false, skipSchema: ["keyword-unions.schema"], // can't handle "constructor" property rendererOptions: {}, - quickTestRendererOptions: [], + quickTestRendererOptions: [{ "runtime-typecheck": "false" }], sourceFiles: ["src/language/JavaScript.ts"] }; @@ -567,7 +571,11 @@ export const FlowLanguage: Language = { "keyword-unions.schema" // can't handle "constructor" property ], rendererOptions: { "explicit-unions": "yes" }, - quickTestRendererOptions: [], + quickTestRendererOptions: [ + { "runtime-typecheck": "false" }, + { "nice-property-names": "true" }, + { "declare-unions": "true" } + ], sourceFiles: ["src/language/Flow.ts"] };