Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Design Meeting Notes, 3/31/2021 #43582

Copy link
Copy link
@DanielRosenwasser

Description

@DanielRosenwasser
Issue body actions

Tracking Substitution Type Replacement

#43427
#43425
#43439

  • We create "substitution types" in conditional types - when writing T extends U ? TrueBranch : FalseBranch, we substitute T with something that's sort of equivalent to T & U in the TrueBranch.
  • Doing a "dumb" substitution.
  • When did we start supporting substitution types on primitives/literals?
    • Turns out it's relied upon quite a bit!

    • If you write "foo" extends keyof T ? ... : ..., you want to make a substitution type of "foo" and keyof T so that you can index into T with it in the true branch!

    • Example:

      // Ensure the following real-world example that relies on substitution still works
      type ExtractParameters<T> = "parameters" extends keyof T
      // The above allows "parameters" to index `T` since all later
      // instances are actually implicitly `"parameters" & keyof T`
          ? {​​
              [K in keyof T["parameters"]]: T["parameters"][K];
          }​​[keyof T["parameters"]]
          : {​​}​​;
  • You can figure that in contravariant positions, you don't actually want to produce the substitution type.
    • The issue is that not every use of a type implies strict variance. You could end up with some invariant and covariant and contravariant uses.
  • Should you create unions in contravariant positions?
    • Hard to reason about - leave it alone for now.
  • PR seems right, get some more eyes on it.

Fixing Excessive Stack Depth Issues

#43249

Performance Depends on Declaration Order

#43437

  • If you have a const that uses an interface before it's declared...it's somehow slower!
  • The spread is also suspicious - spreads can create huge anonymous types.
  • Potentially related to lower type IDs.
    • Subtype reduction picks the one with a lower type ID, but that could be worse to compare against.
    • Also, might just not be hitting the relationship cache.
  • Investigation: start at high number, go down.
    • It didn't work. 😱
  • Unclear what to do about it though.

Decorators Metadata Compat for SES

#43463

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    Design NotesNotes from our design meetingsNotes from our design meetings

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.