You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Invalid code generated if schema contains columns with names that are not valid Typescript identifiers #70
Invalid code is generated if the database schema contains table columns whose names are not valid Typescript identifiers. Specifically, the generated interfaces contain properties that are not valid.
The Typescript spec. applies the same limitations to object properties as it does to identifiers and so the solution appears to be to check whether column names are valid Typescript identifiers during generation and, if so, quote the property name in the generated code.
The following function is not perfect for determining whether a string is a valid Typescript identifier in the general case since keywords may not be used as identifiers. However, modern versions of Typescript do allow keywords to be used as property names so it's good enough for our purposes. In my test code, I added this to utlis.ts:
Activity
fix: Generate valid code for column names that are not TS identifiers