-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Labels
lang:typescriptIssues affecting TypeScript-specific constructs (not general JS issues)Issues affecting TypeScript-specific constructs (not general JS issues)locked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.Please open a new issue and fill out the template instead of commenting.
Description
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
--parser typescriptInput:
const TYPE_MAP = {
'character device': 'special',
'character special file': 'special',
directory: 'directory',
'regular file': 'file',
socket: 'socket',
'symbolic link': 'link',
} as const;Output:
const TYPE_MAP = {
"character device": "special",
"character special file": "special",
directory: "directory",
"regular file": "file",
socket: "socket",
"symbolic link": "link",
} as const;Expected behavior:
The 2.0.2 behavior (above) is expected, but with 2.0.3, I get:
export const LOG_LEVEL =
{
EMERGENCY: 0,
ALERT: 1,
CRITICAL: 2,
ERROR: 3,
WARNING: 4,
NOTICE: 5,
INFO: 6,
DEBUG: 7,
} as const;Only happens with as const qualifier. Without it, formatting continues to be like in 2.0.2:
export const LOG_LEVEL = {
EMERGENCY: 0,
ALERT: 1,
CRITICAL: 2,
ERROR: 3,
WARNING: 4,
NOTICE: 5,
INFO: 6,
DEBUG: 7,
};moltar
Metadata
Metadata
Assignees
Labels
lang:typescriptIssues affecting TypeScript-specific constructs (not general JS issues)Issues affecting TypeScript-specific constructs (not general JS issues)locked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.Please open a new issue and fill out the template instead of commenting.