Fix optional chaining as computed key (#17486)

This commit is contained in:
fisker Cheung authored and GitHub committed 2025-05-28 03:26:56 +08:00
1 parent 55405ce082
commit 242b524eb1
7 files changed
+284 -1

No files matched your search

+20
View File
@@ -0,0 +1,20 @@
#### Fix optional chaining as computed key (#17486 by @fisker)
<!-- prettier-ignore -->
```jsx
// Input
const a = { [y?.z]() {} };
class A { [y?.z]() {} };
// Prettier stable
const a = { [y?.z]?() {} };
class A {
[y?.z]?() {}
}
// Prettier main
const a = { [y?.z]() {} };
class A {
[y?.z]() {}
}
```