-
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
Is this a bug with lerna multi package project with TS4053 error? #40718
Comments
Looks like a duplicate of #9944. I just searched for your error message (excluding the project relevant names) on Google. |
@MartinJohns Thanks for your reply. I've seen this issue yet, but unfortunately it doesn't look like a same issue In #9944 case, I cannot even reproduce the compile error with typescript 4.0.0+,which I can reproduce the "mapping-Foo-Bar" example with typescript 2.0.0. The point is, in my example repo, why the "class.ts" file is considered as a external module when it's in package/src path and be imported by "index.ts", even if they are in the same folder. But it will be fine if I move "index.ts" file and "class.ts" file to root directory? |
Because when you move these files to the root directory, they’re no longer covered by your tsconfig’s This does look like a declaration emitter bug, nothing to do with lerna or where you put your files. As a workaround, just give |
@andrewbranch Thanks for your reply. I am trying to develop a internal js library with lerna, so I have to set the So, is this a tsc bug instead of my mistake? |
I understand, I was just answering your question about why the issue stopped when you moved your files.
At a glance, it looks that way. |
Yes but no? I guess? So I looked at it, and it's because we're doggedly trying to preserve the computed names in the resulting object type of the spread - and the spread doesn't make an intersection, it makes a whole new object type. If you mouse over it in the editor, we print back the (rather unsatisfying) type
this is "as accurate as we could get" with the visibility rules at the position. Declaration emit is trying to preserve the string-enum-yness of the keys, and so is trying to write
but can't find Now, I say this, and this would indicate there's another way you could fix this in the code - adding an explicit import of All this to say: Yeah, there's a bug here, and this should be an easy fix (don't track computed name visibility for non-symbol names, #41806 is up), but it exposes some other broken stuff along the way to getting to that easy fix, which is maybe less straightforward to fix, but also probably less important. |
@weswigham Is this issue fixed? I tried to grok the various related pull requests but this is still occurring in 5.2.2 and it's unclear if a fix was attempted or not. The issue I am experiencing is the same as described in your last comment regarding symbols, and as described in this StackOverflow post. |
Why was this issue closed? This bug still appears to be present (5.5.2) |
We have a merged PR for this (#41806). Please file a new issue with complete repro steps so we can look at your scenario. Thanks! |
TypeScript Version: 4.0.3
Code
This is the repo of demo https://github.com/haha370104/lerna-typescript-error
These files just like this.
Actual behavior:
The "getA" method of class B will cause an error as " error TS4053: Return type of public method from exported class has or is using name 'TestEnum' from external module "/Users/admin/lerna-test/packages/ts-error/src/class" but cannot be named". But if i move these two files to root director, the error will disappear.
I'm don't know why these two file will be recognized to be external module when they in the same lerna package. Also I'm not sure this is a ts issue or my mistake. But it has already cost days for me to search the answer but without result.
Playground Link:
Related Issues:
The text was updated successfully, but these errors were encountered: