microsoft / microsoft/TypeScript

typeToString doesn't respect TypeFormatFlags.MultilineObjectLiterals

Đang mở
#61,348 0 bình luận 1 reaction 1 người được giao Xem trên GitHub

@weswigham đang làm issue này rồi.

Từ ngày 20/3/2025.

Needs Investigation
Ngôn ngữ chính
Go
Star
111k
Fork
14.3k
Merge trung bình
2 ngày 4 giờ
Pull request đã merge (30 ngày)
132

Mô tả

🔎 Search Terms

typeToString

🕗 Version & Regression Information

This is the behavior in every version I tried, and I reviewed the FAQ for entries about typeToString

⏯ Playground Link

No response

💻 Code
const result = typeChecker.typeToString(
  type,
  enclosingDeclaration,
  ts.TypeFormatFlags.UseAliasDefinedOutsideCurrentScope
  | ts.TypeFormatFlags.NoTruncation
  | ts.TypeFormatFlags.MultilineObjectLiterals
)
🙁 Actual behavior

When type is the type of an object literal, the ts.TypeFormatFlags.MultilineObjectLiterals flag causes multiple spaces to be generated between the properties, but not newlines.

🙂 Expected behavior

When type is the type of an object literal, the ts.TypeFormatFlags.MultilineObjectLiterals flag should cause newlines to be generated between the properties.

Additional information about the issue

I'm reporting this because on investigation I found the problem, but in order to generate a PR, I need an issue to refer to!

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.