Skip to content

Adds a error diagnostic with newlines if either source or target are longer than 30 characters on type is not assignable to type #54832

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from

Conversation

orta
Copy link
Contributor

@orta orta commented Jun 29, 2023

Fixes #45896 - this keeps the formatting I recommended in that issue, but that doesn't have to be the answer:

// a is 31 chars long
let a = { b: { c: { e: { f: 123 } } } };
let b = "hello"

b=a

Gives:

Type:
{ b: { c: { e: { f: number; }; }; }; }

is not assignable to type:
string

Which is the simplest version of this PR via diagnostics, there's space here for a few answers which I can look at (having 3 diags, 1 with newlines for source, 1 with newlines for target, 1 with newlines for both)

@typescript-bot typescript-bot added the For Uncommitted Bug PR for untriaged, rejected, closed or missing bug label Jun 29, 2023
@orta
Copy link
Contributor Author

orta commented Jun 29, 2023

I'm not too convinced on indenting unless there is more whitespace:

Type:
  { b: { c: { e: { f: number; }; }; }; }

is not assignable to type:
  string

feels tight to me?

Yet:

Type:

  { b: { c: { e: { f: number; }; }; }; }

is not assignable to type:

  string

Feels a bit too whitespacey though? But open to ideas

@fbartho
Copy link

fbartho commented Jun 29, 2023

I like the indenting personally, not the extra newlines.

eg. (I prefer this:)

Type:
  { b: { c: { e: { f: number; }; }; }; }

is not assignable to type:
  string

[Assuming you wanted bike shedding opinions 😉]

@vdawg-git
Copy link

This looks great! The indents are nice, but extra lines do indeed add too much whitespace.

Copy link
Member

@sandersn sandersn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this but @DanielRosenwasser should also sign off.

@sandersn
Copy link
Member

sandersn commented Apr 2, 2025

I'm going to close this PR for two reasons:

  • We don't have time to add/review new features until we switch to Corsa, at which point this will have to be rewritten in Go.
  • The PR is extremely out of date now.

We should revisit this after Corsa is ready.

@sandersn sandersn closed this Apr 2, 2025
@github-project-automation github-project-automation bot moved this from Waiting on reviewers to Done in PR Backlog Apr 2, 2025
@sandersn sandersn removed this from PR Backlog Apr 22, 2025
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
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
6 participants