Skip to content

Variables with reserved keywords renamed in output, but not reflected in generated typescript #6871

Open
@jimmytimmons

Description

@jimmytimmons

In our app, we have modules representing entity permissions.
e.g:

// Permissions.res
module Products = {
    let createNew = "createPermissionString"
    let viewExisting = "viewPermissionString"
    let delete = "deletePermissionString"
}

// Permissions.resi
module Products = {
   @genType let createNew: string
   @genType let viewExisting: string
   @genType let delete: string
}

However, because delete is a reserved keyword , the compiler instead renames delete to $$delete without reflecting this in the generated tsx file.

// Permissions.gen.tsx
export const Products_createNew: string = PermissionBS.Products.createNew;
export const Products_viewExisting: string = PermissionBS.Products.viewExisting;
export const Products_delete: string = PermissionBS.Products.delete;

Thus any usage of Products_delete in our typescript code would be undefined because we're not consuming PermissionBS.Products.$$delete.

Ideally, the developer avoids reserved keywords altogether, but if the compiler will allow and rename these, I'd expect the genTyped output to reflect any renaming done by the compiler.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions