Open leushkin opened 4 years ago
I think that a bug is here at 181
line. I tried to fix it like that: if refinementedVariants
has length of 1, then it is not a union, so refinementedType
should be subtype of refinementedVariants[0]
. But it didn't work :(
This has nothing to do with refinement, it is an inference bug. This yields the same error.
function isEmptyString(a) {
a === '';
}
const isEmpty = isEmptyString('hello')
In reality a
shouldn't even be inferred as string, it should be unknown
or unconstrained generic.
Ops yep you are right, my fault, I'm going to rename the issue
It will be fixed in the next release. Thank you for the issue. You are awesome :3
https://hegel.js.org/try#GYVwdgxgLglg9mABDAzgUQLYAcoE8DKUATjGAOYAUAhgJSIDeAUIi8sItYgLw+IDkfOk1YjERAKZQQRJMRDjmrAL6NFLCVJmJgVADYoFKxhAQooydNjzcLmHAWKlKfABbjduuIKA
The
a
parameter should be considered as a string.PS probably for not strict equality there is also a bug