TypeScript 使用 readonly T[] 表示数组类型

This commit is contained in:
2021-01-25 16:38:59 +08:00
parent 7c26b9ea48
commit c8d74664b2

View File

@@ -61,7 +61,7 @@ export class TypeScriptExporter extends TableExporter {
type = "any"; type = "any";
break; break;
} }
if (field.is_array) type = `ReadonlyArray<${type}>`; if (field.is_array) type = `readonly ${type}[]`;
if (field.comment) { if (field.comment) {
if (field.comment.trim().length) { if (field.comment.trim().length) {
let comments = field.comment.split("\n"); let comments = field.comment.split("\n");