Skip to content

genType emits escaped quoted identifiers (\"Name") in .gen.tsx for let \"Name" bindings #8312

@WhyThat

Description

@WhyThat

GenType no longer handles quoted uppercase identifier bindings (let "ComponentName") correctly when generating .gen.tsx files. The quoted identifier syntax (necessary to define capitalized bindings in ReScript) is output verbatim in the generated TypeScript, producing invalid Typescript syntax. This was working correctly in ReScript v11.

ReScript source

@genType
let \"Icon_Add": props => React.element = make

Generated .gen.tsx in v12 (broken)

export const \"Icon_Add": (_1:props) => JSX.Element = Icon_AddJS.\"Icon_Add" as any;

\"Icon_Add" is not a valid TypeScript identifier, causing tsc to fail when generating .d.ts files.

Expected .gen.tsx (as generated in v11)

export const Icon_Add: (_1:props) => JSX.Element = Icon_AddJS.Icon_Add as any;

As a workaround, I Post-process .gen.tsx files to strip the escaped quotes

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions