You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Mixin base requires explicit type in TS 4.3 due to "recursively referencing itself" when it doesn't #44284
I'm having a scenario in TS 4.3 where the compiler can no longer figure out the base mixin type implicitly. It seems like a bug to me, but maybe not.
Setup
Here's the starting mixin code with an initial error I get unrelated to this issue I'm reporting (it started happening in TS 3.x something):
I'm not sure what is going on with the error, but I can get around it by doing some indirection or extracting it out to another variable declaration (shown in next image below). This now shows the error I'm reporting here that started happening in TS 4.3 where it says that the type ModuleDeclaration recursively references itself as a base type. It doesn't give any details about where this occurs, so if anything an improvement to that error saying exactly why might be nice.
Workaround (Explicit Type)
Workaround is to explicitly type the base type:
🔎 Search Terms
mixin, recursive
This seems related to #42383, but different in that it only started occuring in TS 4.3.
🕗 Version & Regression Information
This changed between versions 4.2.4 and 4.3
Occurs in 4.4.0-dev.20210526
⏯ Playground Link
Can't figure out a smaller reproduction.
💻 Code
Can't figure out a simple reproduction for this one, but the compile error can be reproduced by following these steps:
As another mixins user, I believe this issue is quite important. If this is a regression in 4.3, then the internal TypeScript test coverage for mixins is not complete yet. Perhaps try to reduce the reproducible case to a bare minimum, I doubt TS team will dig into this themselves..
Oh, looks like this might be a duplicate of #44281, which was logged before this. (Didn't find it while searching because that issue didn't mention mixins)
Could you check if the error happens with 4.3.0-dev.20210428 but does not happen in 4.3.0-dev.20210427?
If so then most probably it is the same bug for sure
Activity
canonic-epicure commentedon May 27, 2021
As another mixins user, I believe this issue is quite important. If this is a regression in 4.3, then the internal TypeScript test coverage for mixins is not complete yet. Perhaps try to reduce the reproducible case to a bare minimum, I doubt TS team will dig into this themselves..
dsherret commentedon May 27, 2021
Oh, looks like this might be a duplicate of #44281, which was logged before this. (Didn't find it while searching because that issue didn't mention mixins)
I will investigate more later.
xaviergonz commentedon May 28, 2021
Could you check if the error happens with 4.3.0-dev.20210428 but does not happen in 4.3.0-dev.20210427?
If so then most probably it is the same bug for sure
dsherret commentedon May 29, 2021
Javier Gonzalez (@xaviergonz) yup, it worked in 4.3.0-dev.20210427, but not 4.3.0-dev.20210428. I'm going to close this one in favour of #44281.