Skip to content

JS native keywords handle #68

@MiaInturi

Description

@MiaInturi

Apicraft generates types.gen.ts through @hey-api/openapi-ts, and a schema named Error is emitted as _Error. This happens because Error is treated as a reserved/global TypeScript identifier by the generator.

The problem is that apicraft’s own plugins do not consistently use the same escaping logic. For example, the faker plugin builds schema type names with capitalize(normalizeName(name)), so for an OpenAPI schema named Error it tries to import/use Error, while types.gen.ts only exports _Error.

As a result, generated files can reference a type that does not exist, causing TypeScript errors when schemas have names like Error, Array, Date, Promise, etc. Apicraft should either mirror @hey-api/openapi-ts identifier escaping in its plugins or expose/pass through a consistent naming strategy so all generated files agree on schema type names.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions