Closed
Description
satisfies
Proposal
x satisfies T
- What about
x as satisfies T
- Why?
- Usable in other places.
<satisfies T>x
in angle-bracket assertions./** @type {satisfies T} */
in JSDoc.
- Angle bracket priority?
- We generally de-prioritize this feature due to JSX.
- But you usually know the type ahead of time. The type coming first allows auto-complete to work better and signals what is coming ahead.
- JSDoc?
- We try not to add new tags that aren't doc'd in the usejsdoc site.
- Ship has sailed with TS-specific syntax in JSDoc, right?
- Seems like the stand-alone
satisfies
syntax is the cleanest and reads the best, even with all the speculative design space.
Massive Slowdown
- We have an optimization whenever we have a large union.
- We have an optimization where if you have very large unions, we try relating in a specific order.
- Someone is using the Babel type definitions where they have a union-based type for their nodes.
@types/babel__traverse
is a discriminated union.get
method was declared with a conditional type.- The true branch creates an internal intersection type in the true branch.
- Converting the conditional type to a type alias allows us to use pre-computed variance calculation on the alias.
- So one option is to fix the type definition in DefinitelyTyped. Dramatically better
- 4.7
- About 7.5 seconds with or without the Definitely Typed fix.
- 4.8
- About 45 seconds today.
- About 6.5 seconds with Definitely Typed fix.
- Also have two PRs to help with this. Doesn't have the same savings as rewriting the conditional to a size, but avoids the regression.
- First - try to remove parts of an intersection.
- Second - remove the relationship cap size/make it higher?
- Debatable cap.
- No, but really shouldn't allow 80 second check-times.
- Can do all.
- But bringing a change in for 4.8? Risky.
- Can try to do this in 4.9, back-port if necessary.
- Also, can try to cache ad-hoc conditonal wthout aliases.
- Conclusions:
- Make the DT test.
- Removing the relationship cap? Experiment.