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, 3/16/2022 #48683

Closed
DanielRosenwasser opened this issue Apr 13, 2022 · 0 comments
Closed

Design Meeting Notes, 3/16/2022 #48683

DanielRosenwasser opened this issue Apr 13, 2022 · 0 comments
Labels
Design Notes Notes from our design meetings

Comments

@DanielRosenwasser
Copy link
Member

Deleting the {} and unconstrained type parameter assignability rule

#33570

(previous design notes at #37388)

  • We used to use {} as the top type. This was before null and undefined.
  • Then we added unknown as a true top type.
  • We made type parameters' implicit upper bound unknown.
  • But we kept a loophole where generic type parameters were assignable to {} to avoid breakages.
  • Should this be gated on strictNullChecks?
  • Try making the apparent type of unknown be unknown #47517 seems related.
    • This PR improved a lot of error messages, but broke a bunch of code.
  • "Non-strictNullChecks is an insane pointless garbage system"
  • Conclusion: at least do this for strictNullChecks.

Error Message on "...could be instantiated with an arbitrary type which could be unrelated to..."

#47889 (review)

#29049

  • We created this message after getting tons of issues around constraints.
  • This is extremely obnoxious when you're 30 error elaborations deep.
    • "By the way, string isn't necessarily assignable to T, thought you might like to know."
    • "Yes, thank you but I have other things to worry about."
  • Honestly, Stack Overflow helps teach people here.
  • Would feel okay getting rid of this for the unconstrained version.
  • Conclusion
    • Would be okay with simplifying error messages here.
    • Open to seeing what it looks like to remove the "unconstrained type parameter check."
    • Open to doing this only for simple types.
@DanielRosenwasser DanielRosenwasser added the Design Notes Notes from our design meetings label Apr 13, 2022
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

1 participant