-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Unwrap NoInfer
-wrapped unions before conditional type distribution attempt
#61077
base: main
Are you sure you want to change the base?
Unwrap NoInfer
-wrapped unions before conditional type distribution attempt
#61077
Conversation
@jakebailey could you prepare a playground build for this one? :p |
@typescript-bot pack this |
@@ -20422,6 +20422,9 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { | |||
const newMapper = createTypeMapper(root.outerTypeParameters, typeArguments); | |||
const checkType = root.checkType; | |||
let distributionType = root.isDistributive ? getReducedType(getMappedType(checkType, newMapper)) : undefined; | |||
if (distributionType && isNoInferType(distributionType)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have 2 doubts here:
- This still doesn't solve the issue with
A | NoInfer<B | C>
. To solve that, it feels likemapTypeWithAlias
andmapType
should learn how to deal with those NoInfer-wrapped unions - Should the conditional type's result be "repacked" into
NoInfer
back if needed? 🤔
Hey @jakebailey, I've packed this into an installable tgz. You can install it for testing by referencing it in your
and then running There is also a playground for this build and an npm module you can use via |
0737761
to
892d183
Compare
fixes #61076