Skip to content

Type width in error messages#1099

Closed
bjatkin wants to merge 3 commits into
microsoft:mainfrom
bjatkin:typeWidthInErrorMessages
Closed

Type width in error messages#1099
bjatkin wants to merge 3 commits into
microsoft:mainfrom
bjatkin:typeWidthInErrorMessages

Conversation

@bjatkin

@bjatkin bjatkin commented Jun 8, 2025

Copy link
Copy Markdown

Fixes microsoft/TypeScript#45896

Currently the complier will print "... is not assignable..." errors on a single line

prettyFormatLongTypes.ts: - error TS2882: Type '{ b: { c: { e: { f: string; }; }; }; }' is not assignable to type '{ b: { c: { e: { f: number; }; }; }; }'
 The types of 'b.c.e.f' are incompatible between these types.
    Type 'string' is not assignable to type 'number'.

This PR puts types onto their own lines when they are >30 characters in length

prettyFormatLongTypes.ts: - error TS2882: Type:
  { b: { c: { e: { f: string; }; }; }; }

is not assignable to type:
  { b: { c: { e: { f: number; }; }; }; }

  The types of 'b.c.e.f' are incompatible between these types.
    Type 'string' is not assignable to type 'number'.

This PR is the typescrpt-go version of this PR microsoft/TypeScript#61829

@jakebailey

Copy link
Copy Markdown
Member

I'm going to mark this as a draft. I don't think we've accepted this feature, and the direction of new features like this needs to be from the TypeScript repo into this one.

@jakebailey
jakebailey marked this pull request as draft June 26, 2025 17:58
@jakebailey

Copy link
Copy Markdown
Member

Thanks, but I'm going to close this; we're not accepting this kind of change at this point, but we can discuss it on the main repo after 7.0.

@jakebailey jakebailey closed this Apr 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use the width of a type to add newlines in type assignment error messages

3 participants