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
Regression with TypeScript "as const" object literal in 2.0.3 #7956
Labels
lang:typescript
Issues affecting TypeScript-specific constructs (not general JS issues)
locked-due-to-inactivity
Please open a new issue and fill out the template instead of commenting.
type:bug
Issues identifying ugly output, or a defect in the program
Comments
sosukesuzuki
added
lang:typescript
Issues affecting TypeScript-specific constructs (not general JS issues)
type:bug
Issues identifying ugly output, or a defect in the program
labels
Apr 5, 2020
This happens for not only const TYPE_MAP = {
'character device': 'special',
'character special file': 'special',
directory: 'directory',
'regular file': 'file',
socket: 'socket',
'symbolic link': 'link',
} as Foo; Output: const TYPE_MAP =
{
"character device": "special",
"character special file": "special",
directory: "directory",
"regular file": "file",
socket: "socket",
"symbolic link": "link",
} as Foo; |
wincent
referenced
this issue
in wincent/wincent
Apr 5, 2020
Prettier 2.0.3 just came out 2 hours ago, and because I am running with `npx`, I get it as soon as I run `yarn format`. I can't see anything obvious in the release notes about it, so there is a chance that it's actually a regression: https://github.com/prettier/prettier/blob/master/CHANGELOG.md#203
I don't know if it's the same problem, but I think it might fit here: Somewhere in our code (real world example), only one example of eleven
this.previewPlayerHandle = (setInterval(async () => {
if (this.previewIsPlaying) {
await this.fetchNextPreviews();
this.currentPreviewIndex++;
}
}, this.refreshDelay) as unknown) as number;
this.previewPlayerHandle =
(setInterval(async () => {
if (this.previewIsPlaying) {
await this.fetchNextPreviews();
this.currentPreviewIndex++;
}
}, this.refreshDelay) as
unknown) as
number; v2.0.2 is MUCH more readable and less noisy Another example
this.intervalID = (setInterval(() => {
self.step();
}, 30) as unknown) as number;
this.intervalID =
(setInterval(() => {
self.step();
}, 30) as
unknown) as
number; ... I will skip v2.0.3 and wait for a patch in v2.0.4+ |
1 task
thorn0
added a commit
to thorn0/prettier
that referenced
this issue
Apr 6, 2020
wincent
changed the title
Possible regression with TypeScript "as const" object literal in 2.0.3
Regression with TypeScript "as const" object literal in 2.0.3
Apr 6, 2020
thorn0
added a commit
that referenced
this issue
Apr 6, 2020
github-actions
bot
added
the
locked-due-to-inactivity
Please open a new issue and fill out the template instead of commenting.
label
Jul 6, 2020
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
lang:typescript
Issues affecting TypeScript-specific constructs (not general JS issues)
locked-due-to-inactivity
Please open a new issue and fill out the template instead of commenting.
type:bug
Issues identifying ugly output, or a defect in the program
Playground hasn't updated to 2.0.3 yet, so this link was generated on 2.0.2 playground:
Prettier 2.0.2
Playground link
Input:
Output:
Expected behavior:
The 2.0.2 behavior (above) is expected, but with 2.0.3, I get:
Only happens with
as const
qualifier. Without it, formatting continues to be like in 2.0.2:The text was updated successfully, but these errors were encountered: