Skip to content

String negative number as index produces wrong declaration #38133

Closed
@christianalfoni

Description

@christianalfoni

TypeScript Version: 3.8.3

Search Terms: decleration, object, index, negative number

Code

export const rotate = {
  "-180": "-180deg",
  "-90": "-90deg",
  "-45": "-45deg",
  "0": "0",
  "45": "45deg",
  "90": "90deg",
  "180": "180deg",
};

Expected behavior:

Should produce the following decleration:

export declare const rotate: {
    "-180": string;
    "-90": string;
    "-45": string;
    0: string;
    45: string;
    90: string;
    180: string;
};

Actual behavior:

Missing quotes, causing errors in the declaration

export declare const rotate: {
    -180: string;
    -90: string;
    -45: string;
    0: string;
    45: string;
    90: string;
    180: string;
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    DuplicateAn existing issue was already created

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions