Skip to content

Type width in error messages#61829

Closed
bjatkin wants to merge 4 commits intomicrosoft:mainfrom
bjatkin:typeWidthInErrorMessages
Closed

Type width in error messages#61829
bjatkin wants to merge 4 commits intomicrosoft:mainfrom
bjatkin:typeWidthInErrorMessages

Conversation

@bjatkin
Copy link
Copy Markdown

@bjatkin bjatkin commented Jun 7, 2025

Fixes #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 based on #54832 which was never merged.

This PR in the typscript-go repo implements the same behavior microsoft/typescript-go#1099

@github-project-automation github-project-automation bot moved this to Not started in PR Backlog Jun 7, 2025
@typescript-bot typescript-bot added the For Uncommitted Bug PR for untriaged, rejected, closed or missing bug label Jun 8, 2025
@bjatkin
Copy link
Copy Markdown
Author

bjatkin commented Jun 8, 2025

@microsoft-github-policy-service agree

@typescript-bot
Copy link
Copy Markdown
Collaborator

The TypeScript team hasn't accepted the linked issue #45896. If you can get it accepted, this PR will have a better chance of being reviewed.

@github-project-automation github-project-automation bot moved this from Not started to Done in PR Backlog Mar 24, 2026
@typescript-bot
Copy link
Copy Markdown
Collaborator

With 6.0 out as the final release vehicle for this codebase, we're closing all PRs that don't fit the merge criteria for post-6.0 patches. If you think this was a mistake and this PR fits the post-6.0 patch criteria, please post to the 6.0 iteration issue with details (specifically, which PR and which patch criteria it satisfies).

Next steps for PRs:

  • For crash bugfixes or language service improvements, PRs are currently accepted at the typescript-go repo
  • Changes to type system behavior should wait until after 7.0, at which point mainline TypeScript development will resume in this repository with the Go codebase
  • Library file updates (lib.d.ts etc) continue to live in this repo or the DOM Generator repo as appropriate

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

For Uncommitted Bug PR for untriaged, rejected, closed or missing bug

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

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

4 participants