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, 9/3/2021 #45718

Closed
DanielRosenwasser opened this issue Sep 3, 2021 · 0 comments
Closed

Design Meeting Notes, 9/3/2021 #45718

DanielRosenwasser opened this issue Sep 3, 2021 · 0 comments
Labels
Design Notes Notes from our design meetings

Comments

@DanielRosenwasser
Copy link
Member

Class Define Semantics and Decorators (useDefineForClassFields + experimentalDecorators)

#45653 (comment)

  • Recently turned on useDefineForClassFields in TS4.4 + target: esnext.
  • Broke people using decorators.
    • One example given replaces a property with a getter/setter pair.
  • No way to provide a heads up that it's not going to work.
  • Could add a lint rule.
    • Nobody's going to see that probably.
  • Maybe we should provide a suggestion or error on experimentalDecorators and esnext?
    • Don't want to add a new flag to say "I know what I'm doing"
    • experimentalDecorators: "iknowhwatimdoing"
  • The workaround today is to add the declare operator on the property.
    • But we don't have a way to message it.
  • Maybe should just continue to keep it the same.
  • What if a decorated thing, when using experimentalDecorators opted you out of Define semantics?
    • "That sounds horrifying to me"
  • Feels like we're okay with a suggestion diagnostic in tsconfig.json.
    • Does it have a quick fix?
    • Doesn't have to.
    • Could make it turn useDefineForClassFields off.
    • Not sure if this is really visible either.

Optimizing on Tail Recursive Conditional Types

#45711

  • Have to enforce some limit because it's possible to write never-ending recursive types.
    • Currently at 1000 iterations.
  • Lots of non-tail-recursive types, so you have to create an accumulator.
  • No breakages we introduce from what we see - but do see a slight regression on material-ui.
  • What happens if someone regresses you to non-tail-call?
    • Some languages allow you to specify whether you need a function to be tail-call optimized.
    • It's really the branch, not the type that is optimizable.
  • Shouldn't force everyone to have an annotation - engines did this.
    • Different for engines. Debugging type instantiation (while nice) is not nearly as much a scenario as debugging your tail-recursive functions.
  • Could always introduce the branch marker after.
  • Any way to turn it off?
    • Can't imagine why you would want that (famous last words).
    • We have a lot of users with interesting use-cases. 😅
    • TS will do more work for longer without just hitting an error.
    • You can always union in each branch with a sentinel type and then strip it out after.

CLI Improvements

  • Error summary? Listing files and error count.
    • Tools will have to adjust their regexes.
  • tsc --init
    • Show the actual options and clean up the errors.
    • Should it leverage --showConfig?
    • What do we do when a LOT of options get printed?
    • Could show only the diff from the defaults.
    • Still a lot.
  • How we present multiple lines
    • Could do multiple versions depending on the type of error.
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