Skip to content

Suggestion Backlog Slog, 11/2/2020 #41372

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

Closed
DanielRosenwasser opened this issue Nov 2, 2020 · 2 comments
Closed

Suggestion Backlog Slog, 11/2/2020 #41372

DanielRosenwasser opened this issue Nov 2, 2020 · 2 comments
Labels
Design Notes Notes from our design meetings

Comments

@DanielRosenwasser
Copy link
Member

DanielRosenwasser commented Nov 2, 2020

Disallow primitives on the right of in

#41317

Approved.

To avoid breakage on unconstrained type parameters, we're thinking to check if the type is assignable to the union of all primitive types - or if it contains any primitive type (e.g. number, string, boolean, bigint, symbol, null, undefined). isTypeAssignableToKind might be one thing to use here, if not, just use isAssignableTo.

If that's still too breaky, maybeTypeOfKind is a helper that can do this pretty quickly.

The more thorough version of this would be to check whether the type on the right side of the in has to be assignable to object. We could run that on the RWC.

this gets narrowed to NonNullable<this> in ?.

#41340

  • this in parameter position was never really coherent
  • Could technically never really have a parent of type this.
  • Maybe we should narrow left sides of the . and ?. in argument positions.
  • If we rejected a NonNullable after every . it might get rough.
    • Only need to do it when feeding a dotted name back into a deeper method call.

Seems like any reference to the left of a . or ?. should in principle be narrowed, but we have concerns around the control flow graph. We would accept an experiment PR, but we are not committed to this, especially if there are perf/memory ramifications.

Destructuring array, ability to explicitly tell the variable is unused

#31388

Seems fine!

Kind of cool aside: C# has a new rule that you can have multiple variables named _ provided that they're declared in the same scope.

@DanielRosenwasser DanielRosenwasser added the Design Notes Notes from our design meetings label Nov 2, 2020
@yume-chan
Copy link
Contributor

Disallow primitives on the left of in

Should be right?

@DanielRosenwasser
Copy link
Member Author

Yes, fixing now

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