-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
Add Dependent-Type-Like Functions [Experiment] #33237
Conversation
@typescript-bot perf test this |
Heya @jack-williams, I've started to run the perf test suite on this PR at 2f44452. You can monitor the build here. It should now contribute to this PR's status checks. Update: The results are in! |
@jack-williams Here they are:Comparison Report - master..33237
System
Hosts
Scenarios
|
2f44452
to
feb5235
Compare
I have pushed an initial implementation of this feature based on input from @jack-williams . Roughly it works as follows: A This type mapper creates an instantiation for type variables based on traversing the control flow graph. The conditions for activating in this traversal are currently: on a binary equality expression when one of the sides is a literal and the other side is an identifier annotated with a type parameter defined in the function, which is bounded by a union of singleton types. Currently this type mapper is an optional parameter and I have passed it around to make the use cases in the test cases (tests/cases/compiler/depTypeLikeFun.ts). Likely the type mapper needs to be passed around in more situations to make other complex scenarios work. This type mapper is then used inside the Some next steps regarding this implementation:
@jack-williams @RyanCavanaugh @DanielRosenwasser Feedback / Comments are welcome. |
This experiment is pretty old, so I'm going to close it to reduce the number of open PRs. |
This PR doesn't have any linked issues. Please open an issue that references this PR. From there we can discuss and prioritise. |
Initial experiments for implementing dependent-type-like functions, #33014 .