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

Design Meeting Notes, 2/21/2020 #36946

Closed
DanielRosenwasser opened this issue Feb 21, 2020 · 0 comments
Closed

Design Meeting Notes, 2/21/2020 #36946

DanielRosenwasser opened this issue Feb 21, 2020 · 0 comments
Labels
Design Notes Notes from our design meetings

Comments

@DanielRosenwasser
Copy link
Member

DanielRosenwasser commented Feb 21, 2020

Update on Reducing Impossible Intersections

#28663

  • Better errors because a bunch of empty intersections
  • A couple of failures on DefinitelyTyped
    • 2 are legit: trying to access properties or extend from an empty intersection
    • 1 thing that failed was Ramda
      • Uses ts-toolbelt
        • Depends on keyof (A & B) being the same as (keyof A) | (keyof B), which is still true except for when the intersection is empty.
          • If A & B more-often reduces to never (the proposed change), then keyof (A & B) should become keyof never.
        • Fixable by sending a PR to ts-toolbelt - but that doesn't necessarily mean that other things won't break.
  • How can a user diagnose the keyof (A & B) being the same as keyof never (being the same as never)?
    • We special-cased to print back never for A & B.
    • We need to ensure that A & B doesn't leak - it has to be an implementation detail.
      • Are the updates for that finite and known.
  • Conclusion: probably good to go, @ahejlsberg will need to ensure we have consistent behavior during type argument inference.

Permitting Deeply Nested Conditionals

#28663

  • Two "competing" solutions
  • For each of these, we just keep diving into each conditional and increment the type instantiation counter, which eventually triggers the type limiter.
  • A lot of people's mental model is that each layer of the conditional belongs to one over-arching construct.
  • The limitation is that this the first approach is limited to syntactically nested conditional types.
    • Lots of cases where there are conditionals with type aliases to each other.
    • So there's a broader problem.
    • Also, would the original change mean we would never cache the deeper conditional?
      • No, you only need to cache at the top level.
      • But that's not true for the type aliases case.
        • But we only "optimize" here for the syntactic case - otherwise we will cache.
  • Can we combine these approaches? e.g. optimize for syntactic cases and then still avoid triggering the depth increment cases.
    • Seems like yes.
  • Also, this code looks like people are trying to discriminate on types - would there be some optimizations?
  • These both help pathological cases - does it impact the simple case?
  • Conclusion: @weswigham and @ahejlsberg to work together and explore combining both approaches.
@DanielRosenwasser DanielRosenwasser added the Design Notes Notes from our design meetings label Feb 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Design Notes Notes from our design meetings
Projects
None yet
Development

No branches or pull requests

2 participants