-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Regression: Unrelated line causes complex type check error to disappear #29393
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
Comments
I just did a git bisect because this issue is preventing me from upgrading from 3.0 to a newer version of TS. The first bad commit is e2100cd by @weswigham , which was merged in #27804 I guess this comment is relevant:
Sadly I'm not really able to understand that code, otherwise I would try and fix it myself. I'm guessing it's related to this part: e2100cd#diff-c3ed224e4daa84352f7f1abcd23e8ccaR11944 I might be able to add a test case if that would help you fix it? bisect log:
|
@weswigham FYI, when mapped types are excluded from the logic based on variance measuring for aliased types, the issues in this PR and #29698 disappear, so that's one possible fix. But of course the issue still exists for a mapped type nested in a conditional type. |
The real issue here is the inconsistency due to caching, not the variance measurements (we already knew variance was occasionally incorrect, which is why it is permissive and allows fallback to structural comparisons). That a second route to comparing |
Hahhhh, yeah - it's not the variance checking, per sey, that is causing the issue - in I'm going to unify the two blocks, and then ensure the final result doesn't depend on |
Right, agreed that the real issue in this PR is the inconsistent error message. But of course we also need to tackle the issue in #29698. |
TypeScript Version: No issue in 3.0.3, broken in both 3.2.2 and 3.3.0-dev.20190112 (using tsconfig from
tsc --init
)Search Terms: unrelated, nondeterministic, mapped type, generic
Code
I'm sorry, I couldn't manage to reduce this further since it disappears when the code is too simple (probably some checking depth limitation?)
Expected behavior: No type error regardless of whether the line
//tmp2(tmp1)
is commented or not.Actual behavior:
When that line is commented out, I get a type error in the
export class
line, which is completely unrelated:Playground Link: Impossible because it stops happening when Type and TypeOf are inlined.
I know the above code looks dumb, but trust me this is causing weird breakage in a large code base.
The text was updated successfully, but these errors were encountered: