File tree Expand file tree Collapse file tree 1 file changed +3
-1
lines changed
templates/cli/lib/type-generation/languages Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -90,7 +90,9 @@ export enum <%- toPascalCase(attribute.key) %> {
90
90
<% for (const [index, collection] of Object .entries(collections)) { -%>
91
91
export type <% - toPascalCase(collection.name) %> = Models.Row & {
92
92
<% for (const attribute of collection.attributes) { -%>
93
- <% - strict ? toCamelCase(attribute.key) : attribute.key %> : <% - getType(attribute, collections) %> ;
93
+ <% const propertyName = strict ? toCamelCase(attribute.key) : attribute.key; -%>
94
+ <% const isValidIdentifier = /^[a-zA-Z_$][a-zA-Z0-9_$] *$/ .test (propertyName); -%>
95
+ <% if (isValidIdentifier) { %><% - propertyName %><% } else { %> "<% - propertyName %> "<% } %> : <% - getType(attribute, collections) %> ;
94
96
<% } -%>
95
97
}<% if (index < collections.length - 1 ) { %>
96
98
<% } %>
You can’t perform that action at this time.
0 commit comments