Skip to content

Generated types ClientErrorStatus & ServerErrorStatus TS2514: A tuple type cannot be indexed with a negative value. #136

Closed
@somethingnew2-0

Description

Generated code throws a typescript error from https://github.com/fabien0102/openapi-codegen/blob/main/plugins/typescript/src/templates/utils.ts#L14-L15

ERROR in src/api/apiUtils.ts:9:21
TS2514: A tuple type cannot be indexed with a negative value.
     7 |
     8 | export type ClientErrorStatus = Exclude<
  >  9 |   ComputeRange<500>[-1],
       |                     ^^
    10 |   ComputeRange<400>[-1]
    11 | >;
    12 | export type ServerErrorStatus = Exclude<


ERROR in src/api/apiUtils.ts:10:21
TS2514: A tuple type cannot be indexed with a negative value.
     8 | export type ClientErrorStatus = Exclude<
     9 |   ComputeRange<500>[-1],
  > 10 |   ComputeRange<400>[-1]
       |                     ^^
    11 | >;
    12 | export type ServerErrorStatus = Exclude<
    13 |   ComputeRange<600>[-1],

ERROR in src/api/apiUtils.ts:13:21
TS2514: A tuple type cannot be indexed with a negative value.
    11 | >;
    12 | export type ServerErrorStatus = Exclude<
  > 13 |   ComputeRange<600>[-1],
       |                     ^^
    14 |   ComputeRange<500>[-1]
    15 | >;
    16 |

ERROR in src/api/apiUtils.ts:14:21
TS2514: A tuple type cannot be indexed with a negative value.
    12 | export type ServerErrorStatus = Exclude<
    13 |   ComputeRange<600>[-1],
  > 14 |   ComputeRange<500>[-1]
       |                     ^^
    15 | >;
    16 |

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions