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) %> {
9090<% for (const [index, collection] of Object .entries(collections)) { -%>
9191export type <% - toPascalCase(collection.name) %> = Models.Row & {
9292<% 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) %> ;
9496<% } -%>
9597}<% if (index < collections.length - 1 ) { %>
9698<% } %>
You can’t perform that action at this time.
0 commit comments