Keep an own-line comment before a satisfies or as type on its own line (#19939)

Co-authored-by: fisker <lionkay@gmail.com>
This commit is contained in:
Miodrag Obradovicandfisker authored and GitHub committed 2026-08-31 06:48:06 +08:00
1 parent 5a0fdd9740
commit 5fd5b6908b
9 files changed
+163 -62

No files matched your search

@@ -0,0 +1,33 @@
#### Fix misaligned jsdoc comment before a `satisfies` or `as` type (#19939 by @Kjubikstronk)
<!-- prettier-ignore -->
```tsx
// Input
const foo = {
bar: 1,
} as
/**
* comment line 1
* comment line 2
*/
Foo;
// Prettier stable
const foo = {
bar: 1,
} as /**
* comment line 1
* comment line 2
*/
Foo;
// Prettier main
const foo = {
bar: 1,
} as
/**
* comment line 1
* comment line 2
*/
Foo;
```
+29
View File
@@ -0,0 +1,29 @@
#### Keep an own-line comment before a `satisfies` or `as` type on its own line (#19939 by @Kjubikstronk)
<!-- prettier-ignore -->
```tsx
// Input
const foo = {
bar: 1,
} as
// Comment
Record<string, number>;
// Prettier stable (first format)
const foo = {
bar: 1,
} as // Comment
Record<string, number>;
// Prettier stable (second format)
const foo = {
bar: 1,
} as Record<string, number>; // Comment
// Prettier main
const foo = {
bar: 1,
} as
// Comment
Record<string, number>;
```