Skip to content

String negative number as index produces wrong declaration #38133

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
christianalfoni opened this issue Apr 23, 2020 · 5 comments
Closed

String negative number as index produces wrong declaration #38133

christianalfoni opened this issue Apr 23, 2020 · 5 comments
Labels
Duplicate An existing issue was already created

Comments

@christianalfoni
Copy link

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;
};
@a-tarasyuk
Copy link
Contributor

a-tarasyuk commented Apr 23, 2020

The fix for the negative numbers was added in this PR #37936 (#37866)

cc @RyanCavanaugh

@nmain
Copy link

nmain commented Apr 23, 2020

Works in nightly: Playground Link

The issue template does ask you to try in nightly before reporting a bug 😃

@christianalfoni
Copy link
Author

Great to hear it is fixed! 😄

Sorry, but I did not understand that this playground was different than the one on Typescript website? Cause that one only shows the JS output. I see this other Playground shows everything, is this some special playground?

@nmain
Copy link

nmain commented Apr 23, 2020

Ahh yes, that's the beta version of the next playground. Eventually we all will have the power!

@RyanCavanaugh RyanCavanaugh added the Duplicate An existing issue was already created label Apr 24, 2020
@typescript-bot
Copy link
Collaborator

This issue has been marked as a 'Duplicate' and has seen no recent activity. It has been automatically closed for house-keeping purposes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

5 participants