Add tests to close issue 16121 (#18040)

This commit is contained in:
fisker Cheung authored and GitHub committed 2025-10-11 02:58:57 +08:00
1 parent aba13a2e36
commit ae43bcf68c
2 files changed
+123

No files matched your search

+38
View File
@@ -0,0 +1,38 @@
export type IntersectionType =
& FirstPart
// Presence of comment makes this non-idempotent
& {
an: string,
object: string,
type: string,
}
export type IntersectionType =
& FirstPart
// Comment Line 1
// Comment Line 2
& {
an: string,
object: string,
type: string,
}
export type IntersectionType =
| FirstPart
// Presence of comment is not a problem
| {
an: string;
object: string;
type: string;
};
export type IntersectionType =
| FirstPart
// Comment Line 1
// Comment Line 2
| {
an: string;
object: string;
type: string;
};
@@ -250,6 +250,91 @@ class Foo {
================================================================================
`;
exports[`16121.ts format 1`] = `
====================================options=====================================
parsers: ["typescript"]
printWidth: 80
| printWidth
=====================================input======================================
export type IntersectionType =
& FirstPart
// Presence of comment makes this non-idempotent
& {
an: string,
object: string,
type: string,
}
export type IntersectionType =
& FirstPart
// Comment Line 1
// Comment Line 2
& {
an: string,
object: string,
type: string,
}
export type IntersectionType =
| FirstPart
// Presence of comment is not a problem
| {
an: string;
object: string;
type: string;
};
export type IntersectionType =
| FirstPart
// Comment Line 1
// Comment Line 2
| {
an: string;
object: string;
type: string;
};
=====================================output=====================================
export type IntersectionType = FirstPart &
// Presence of comment makes this non-idempotent
{
an: string;
object: string;
type: string;
};
export type IntersectionType = FirstPart &
// Comment Line 1
// Comment Line 2
{
an: string;
object: string;
type: string;
};
export type IntersectionType =
| FirstPart
// Presence of comment is not a problem
| {
an: string;
object: string;
type: string;
};
export type IntersectionType =
| FirstPart
// Comment Line 1
// Comment Line 2
| {
an: string;
object: string;
type: string;
};
================================================================================
`;
exports[`16207.ts format 1`] = `
====================================options=====================================
parsers: ["typescript"]