Skip to content
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

[WIP] Remove unnecessary weak types when reporting errors #25145

Closed
wants to merge 4 commits into from

Conversation

DanielRosenwasser
Copy link
Member

@DanielRosenwasser DanielRosenwasser commented Jun 22, 2018

Ignore for now - I've made some changes that actually make errors worse.

Fixes #24146.

When a source type still isn't assignable to an intersection with all the weak types removed, we can generally assume that the "strong" types are the ones that are more interesting to report on. As an improvement, we try to keep them around and remove weak types which we believe will cause noise.

While this sometimes has undesirable effects when there are incompatibilities among strong types and weak types, this by and large gives better behavior when dealing with types like JSX's IntrinsicAttributes.

… whole) types when reporting errors.

Summary: When a source type still isn't assignable to an intersection with all the weak types removed,
we can generally assume that the "strong" types are the ones that are more interesting to report on.
As an improvement, we try to keep them around and remove weak types which we believe will cause noise.
@DanielRosenwasser DanielRosenwasser force-pushed the strongTypesForLargeErrors branch from d65fb96 to 7054e73 Compare June 22, 2018 05:30
@@ -0,0 +1,96 @@
tests/cases/compiler/errorsOnWeakTypeIntersectionTargets01.ts(10,12): error TS2322: Type '{ a: number; b: number; }' is not assignable to type 'A & B'.
Type '{ a: number; b: number; }' is not assignable to type 'B'.
Type '{ a: number; b: number; }' is not assignable to type 'B'.
Copy link
Member Author

Choose a reason for hiding this comment

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

This seems bad.

@DanielRosenwasser DanielRosenwasser changed the title Remove unnecessary weak types when reporting errors [WIP] Remove unnecessary weak types when reporting errors Jun 22, 2018
@RyanCavanaugh
Copy link
Member

Closing for housekeeping 🧹

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.

2 participants