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
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
Bug Report
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
⏯ 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:
yarn setup
in the root (sorry, it's slow right now).ModuleDeclarationBase
in packages/ts-morph/src/compiler/ast/module/ModuleDeclaration.ts to no longer have an explicit type.yarn build
inpackages/ts-morph
or look at error in VS code via the language service.🙁 Actual behavior
Error stating
Type 'ModuleDeclaration' recursively references itself as a base type.
🙂 Expected behavior
No error.
The text was updated successfully, but these errors were encountered: