Skip to content
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

2.1 removes quotes from numeric keys in flow types #9036

Closed
TrySound opened this issue Aug 24, 2020 · 5 comments
Closed

2.1 removes quotes from numeric keys in flow types #9036

TrySound opened this issue Aug 24, 2020 · 5 comments
Labels
locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting.

Comments

@TrySound
Copy link
Contributor

Prettier 2.1.0
https://prettier.io/playground/#N4Igxg9gdgLgprEAuEATOYA2BDATnAAhgE8AHQgYQkwlwIF4DgAfAHSgIIHIBWABi5ICAZxi4AllADmAGnacuARj4ChoidLkduAJhWCRYybPncAzPrVHNprgBZLhjSajMAviBkgIpGOOjCyKB4uBAA7gAKeAiBKNiYYdjEgV4ARrjYYADWcDAAyqSZxshiAK5wXnAAtqlwqOioADLY0qXYUnAAYrRV2DB+0sgg2KUwEJ4gABYwVZgA6pPi8MKFYHB5MUviAG5LxENgwikgksJwuDARGVK9yABm8WdeAFbCAB4AQhnZuXnYVXBGpI4PdHhUQK83nljJg4ABFUoQeCgzBPECFXBnXBDVLYWqYCakDQwObiVAwSbIAAcfC8RIgZzmGVIQyJcCx2xBXgAjoj4FcfLFhsIALRQOB1OoTfC88T4K7tW5IB6o8FnKriEq4cpeYQw+F8kHKsFeGB40nkylIHSmjLiTDGKhVJUgdk8CalM4AFTxsRVaO25QAklB0LA8mAJL4AIKhvIkWEos5uNxAA

# Options (if any):
--single-quote

Flow does not allow numeric keys without quotes in types. In objects it's not allowed as well though this is something I could deal with. With types it's a bug.

Input:

declare type Color = {|
  '50': string,
  '100': string,
  '200': string,
  '300': string,
  '400': string,
|}

Output:

declare type Color = {|
  50: string,
  100: string,
  200: string,
  300: string,
  400: string,
|};

Expected behavior:

declare type Color = {|
  '50': string,
  '100': string,
  '200': string,
  '300': string,
  '400': string,
|}
@fisker
Copy link
Member

fisker commented Aug 24, 2020

flow or babel-flow parser is recommended, they don't remove quotes.

@TrySound
Copy link
Contributor Author

This looks like a solution. Thanks.

@fisker
Copy link
Member

fisker commented Aug 24, 2020

@TrySound A unrelated question, do you use flow with @flow comment? I proposed to drop flow support from babel parser in #8204, and @thorn0 suggest that auto switch to babel-flow if @flow found(or maybe .flow.js in filename too), if we do that you would be able to use babel without breaking your code.

@TrySound
Copy link
Contributor Author

TrySound commented Aug 24, 2020

Yes, I always use flow annotation.

@fisker
Copy link
Member

fisker commented Aug 24, 2020

Thank you!

@github-actions github-actions bot added the locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. label Nov 23, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 23, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting.
Projects
None yet
Development

No branches or pull requests

2 participants