-
Notifications
You must be signed in to change notification settings - Fork 784
Description
Hey! 👋
I've been thinking about type readability in hover/quickinfo output and wanted to float an idea.
The problem
Complex types can get pretty hard to parse visually, especially with intersection types or deeply nested objects. The prettify-ts extension for VS Code tackles this for tsserver and has gotten quite popular (~330 stars, ~50k installs), which suggests it's scratching a real itch for people.
Quick example
Given:
type User = { id: string; name: string };
type Timestamps = { createdAt: Date; updatedAt: Date };
type UserRecord = User & Timestamps & { role: "admin" | "user" };
const user: UserRecord = /* hover here */Today:
const user: User & Timestamps & { role: "admin" | "user" }Prettified:
const user: {
id: string;
name: string;
createdAt: Date;
updatedAt: Date;
role: "admin" | "user";
}The idea
Would it make sense to have this as an optional flag somewhere? Maybe a TypeFormatFlag, an LSP setting, or even a tsconfig option. Nothing too fancy, just a way to opt into expanded type display.
I totally understand if this is low priority while you're focused on feature parity! But if there's interest, I'd be happy to put together a PR.
Thanks for all the work on this project, I've been very happy using it so far.