#20170·prettier

`semi: false`: a key unquoted by `quoteProps` loses its ASI protection

Author: leonidazCreated Sep 28, 2026Updated Sep 28, 2026

Prettier 3.9.9

Example 1

Playground link

bash
--parser typescript
--no-semi

Input:

typescript
class C {
  x = a
  "in"() {}
}

Output:

typescript
class C {
  x = a
  in() {}
}

Second format (of the output above) fails:

Expression expected. (3:6)

Example 2

Playground link

bash
--parser typescript
--no-semi

Input:

typescript
interface I {
  "get"
  a: string
}

Output:

typescript
interface I {
  get
  a: string
}

Second format (of the output above) fails:

'(' expected. (3:4)

Expected output

typescript
class C {
  x = a;
  in() {}
}

interface I {
  get;
  a: string
}

Why?

Written unquoted in the input (x = a; + in() {}, get; + a: string), Prettier keeps the ;. The quoted key is unquoted after that check, so the output reads as x = a in ()… and as a get a accessor, and neither parses.

Related: #1875 (the same for keys written unquoted, fixed), #19618.

Also reproduces on main (88d8e96).