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

Skip excess property elaborations #29760

Closed
wants to merge 6 commits into from

Conversation

DanielRosenwasser
Copy link
Member

Tries to fix #29759, but I haven't gotten the chance to review the baselines (I know, sounds dumb but I'm on a phone call now). One thing to keep in mind is the fact that we lose context of which branch in a union we're picking. That can be pretty bad, and I'm not sure exactly how to address that.

@DanielRosenwasser
Copy link
Member Author

Looks like this only fails because jake baseline-accept doesn't necessarily update unit tests.

@CyrusNajmabadi
Copy link
Contributor

Exciting!

@DanielRosenwasser
Copy link
Member Author

@weswigham @RyanCavanaugh can you take a look?

!!! error TS2322: Types of property 'prop' are incompatible.
!!! error TS2322: Type '{ colour: string; }' is not assignable to type 'CSSProps'.
!!! error TS2322: Object literal may only specify known properties, but 'colour' does not exist in type 'CSSProps'. Did you mean to write 'color'?
!!! error TS2561: Object literal may only specify known properties, but 'colour' does not exist in type 'CSSProps'. Did you mean to write 'color'?
!!! related TS6500 tests/cases/compiler/nestedFreshLiteral.ts:5:3: The expected type comes from property 'nested' which is declared here on type 'NestedCSSProps'
Copy link
Member Author

Choose a reason for hiding this comment

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

Do these two messages mix well together?

!!! error TS2322: Type '() => { foo: string; jj: number; }' is not assignable to type '() => Style'.
!!! error TS2322: Type '{ foo: string; jj: number; }' is not assignable to type 'Style'.
!!! error TS2322: Object literal may only specify known properties, and 'jj' does not exist in type 'Style'.
!!! error TS2353: Object literal may only specify known properties, and 'jj' does not exist in type 'Style'.
Copy link
Member Author

Choose a reason for hiding this comment

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

I think this is a minor improvement. (/s I think this is way better)

@DanielRosenwasser
Copy link
Member Author

@sandersn @weswigham any chance you can take a look here?

Copy link
Member

@weswigham weswigham left a comment

Choose a reason for hiding this comment

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

I know I mentioned this the other day, but cutting the entire diagnostic trail seems wrong to me. However, I can certainly see how the A is not assignable to B error immediately above the extra props error as usually not being needed. Would it be okay to just suppress a single level of the diagnostic message chain, rather than deleting the entire chain?

Take this one:

Conversion of type '{ foo: string; }[]' to type '{ id: number; }[]' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
Type '{ foo: string; }' is not comparable to type '{ id: number; }'.	
    Object literal may only specify known properties, and 'foo' does not exist in type '{ id: number; }'.

cutting it to just

Object literal may only specify known properties, and 'foo' does not exist in type '{ id: number; }'.

seems excessive - I have no idea why I'm getting an excess property warning here. But

Conversion of type '{ foo: string; }[]' to type '{ id: number; }[]' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
    Object literal may only specify known properties, and 'foo' does not exist in type '{ id: number; }'.

is i think an OK compromise.

@orta
Copy link
Contributor

orta commented Sep 25, 2019

This is /basically/ replaced by #33473 so I'm closing. I get that they're not exactly the same, but they more or less have the same goals.

@orta orta closed this Sep 25, 2019
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.

Error messages should place most relevant information first.
5 participants