$ rome rage --summary
Environment Variables
Object {
COLORTERM: "truecolor"
LANG: "en_US.UTF-8"
TERM: "xterm-256color"
TERM_PROGRAM: "vscode"
}
User Config
unset
Rome Version
10.0.4-beta-dev
Node Version
12.16.3
Platform
darwin x64 18.7.0
Terminal Features
Object {
background: "unknown"
colorDepth: 24
columns: 170
cursor: true
hyperlinks: true
isTTY: true
progress: true
unicode: true
}
Client Flags
Object {
clientName: "cli"
silent: false
cwd: ___R$project$rome$$internal$path$index_ts$AbsoluteFilePath: /Users/yeonjuan/Desktop/open-source/tools
realCwd: ___R$project$rome$$internal$path$index_ts$AbsoluteFilePath: /Users/yeonjuan/Desktop/open-source/tools
}
Server Status
Object {
projects: Array [
Object {id: 0}
Object {id: 1}
]
server: Object {
heapTotal: 27_672_576
pid: 84_558
uptime: 0.781767559
}
workers: Array [
Object {
astCacheSize: 0
heapTotal: 27_672_576
ownedBytes: 0n
ownedFileCount: 0
pid: 84_558
uptime: 0.78147324
}
]
}
.tsx extension // test.tsx
const func = <T,>() => {
}
$ ./rome format test.tsx
const func = <T>() => {}; // ts error: JSX Element `T` has no corresponding closing tag
The result makes ts parsing error so it should not remove trailing comma.
const func = <T,>() => {};
At the beginning I thought it was a typescript bug it's not! Although it seems strange having a trailing comma
it's the only way for typescript to differentiate the initial type assertion syntax in tsx file with jsx ie
// *.ts
const a = <string>bar;
const b = bar as string;
// *.tsx
// error
const a = <string>bar;
// fine
const a = <string,>bar;
const b = bar as string;
They've introduced the as syntax in v1.6 to preserve assertions in tsx files, the comma trick was introduced later on as far as I know
Most helpful comment
it's the only way for typescript to differentiate the initial type assertion syntax in tsx file with jsx ie
They've introduced the
assyntax in v1.6 to preserve assertions intsxfiles, the comma trick was introduced later on as far as I know