Skip to content

Commit

Permalink
rename preferReadonly to readonly
Browse files Browse the repository at this point in the history
  • Loading branch information
inferrinizzard committed Mar 30, 2024
1 parent dc5bed2 commit 598ad95
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions packages/quicktype-core/src/language/TypeScriptFlow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const tsFlowOptions = Object.assign({}, javaScriptOptions, {
"Use string instead of enum for string enums with single value",
false
),
preferReadonly: new BooleanOption("prefer-readonly", "Use readonly type members", false)
readonly: new BooleanOption("readonly", "Use readonly type members", false)
});

const tsFlowTypeAnnotations = {
Expand All @@ -54,7 +54,7 @@ export abstract class TypeScriptFlowBaseTargetLanguage extends JavaScriptTargetL
tsFlowOptions.preferUnions,
tsFlowOptions.preferTypes,
tsFlowOptions.preferConstValues,
tsFlowOptions.preferReadonly
tsFlowOptions.readonly
];
}

Expand Down Expand Up @@ -173,7 +173,7 @@ export abstract class TypeScriptFlowBaseRenderer extends JavaScriptRenderer {
let propertyName: Sourcelike = name;
propertyName = modifySource(quotePropertyName, name);

if (this._tsFlowOptions.preferReadonly) {
if (this._tsFlowOptions.readonly) {
propertyName = modifySource(_propertyName => "readonly " + _propertyName, propertyName);
}

Expand Down
2 changes: 1 addition & 1 deletion test/languages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -785,7 +785,7 @@ export const TypeScriptLanguage: Language = {
["pokedex.json", { "prefer-types": "true" }],
{ "acronym-style": "pascal" },
{ converters: "all-objects" },
{ "prefer-readonly": "true" }
{ readonly: "true" }
],
sourceFiles: ["src/language/TypeScript.ts"]
};
Expand Down

0 comments on commit 598ad95

Please sign in to comment.