-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
importHelpers with symlinks breaks type resolution #29221
Comments
I can't seem the repro the issue with the steps provided (builds fine both ways) - what platform and filesystem case-sensitivity are you on? |
@weswigham I'm using Linux and F2FS, but I don't think it mattered. |
Is F2FS a case-sensitive filesystem? |
@weswigham According to Wikipedia, yes |
@weswigham You can repro this by setting |
Similar problem here and I guess the reason is the same. Typescript 3.2.2. Downgrade to 3.1.3 and everthing is fine. Works fine on Mac and Ubuntu but breaks on Windows, which is using NTFS for sure.
|
I ran into this issue as well. My project was built with Bazel. A few snippets to reproduce the error: import {Parser as ParserBase} from 'chevrotain'
const parser = createParser()
// @ts-ignore: TS2742
const BaseCstVisitor = parser.getBaseCstVisitorConstructor();
function createParser(): Parser {
return new Parser()
}
class Parser extends ParserBase {
...
} The compilation error after upgrading from ts
What I want is the ability to just mute this TS2742 error and make the code compile again. I have tried adding Help needed. Thanks in advance! |
We're having this problem with Bazel-built typescript as well. Bazel symlinks all the |
Well, I've not only encountered this thing, but got a minimal repro with the weird behavior hapening on 3 computers: I'm just not sure whether this is a TypeScript or VS Code bug. When you clone the repo, just run
If it's not there, restart VS Code and you should see it at least then. NB! If run the compiler with Now, go to The error also goes away when you import But then I get another error:
So yeah. Compiler does not complain about this, but VS Code does. |
An interesting detail: if I uninstall |
Ooook. More info: Turns out, when I removed the flag for outputs to be generated, I got the error here too. I guess the declarations part is the one erroring out, isn't it? /cc @SeaRyanC |
Got the same issue in my project. I resolved the error by being more explicit regarding the return type. So instead of writing the following:
I changed it to
Now it compiles with no tricks |
I've got the same issue when running in a @microsoft/rush monorepo |
I'm getting the same error when using oclif to scaffold some code. Some of the generated code looks like this: import {Command, flags} from '@oclif/command'
export default class Hello extends Command {
static flags = { ... }
} I get the following error: However, adapting @JackTheRipper's solution, I added an explicit type annotation like so: import {Command, flags} from '@oclif/command'
export default class Hello extends Command {
static flags: flags.Input<any> = { ... }
} Adding the annotation made the error go away. |
Well, because "A type annotation is necessary", but this looks very magical-realistic to me since the type annotation is clearly traceable and "parsable" by human interaction, i.e. just hover on the problematic section/variable/expression, 99% of the time you can see the recognized types in your IDE. |
@weswigham I've attempted to create a repro over on #29808 (related issue) |
We are also facing this problem on our builds. Adding the type annotation manually is not viable since we are building third party code. It works using regular Yarn but fails when we symlink the |
This issue is really annoying! Why is closed? |
@nthypes because the TS team is so naively thinking it's finally put a nail in the coffin. we still need more regression test to handle this. Sadly I'm still in work and the university semester is going to start I probably had no time to handle this for everybody. |
The reason this issue is closed is because there's nothing actionable in the thread at this point, and what was actionable was fixed, best as could be observed - if you have a codebase that still has an issue on the latest builds, opening a new issue with a full set of reproduction steps (as these kinds of issues are super sensitive to compiler settings, host environment, and actual code layout on disk) would be useful and tracking down and squashing the bug. But in many instances, seeing the error reported isn't a bug - even in |
@Roaders I'm having the same problem. Did you manage to find a solution ? |
Same here, downgrading to 3.1.3 did it. VSCode auto import functionality works again in TS files. |
…fix downstream build Change-Id: I9eee44451b2ed41382cda9a446c47fc5c8f39e33 Signed-off-by: nickboldt <nboldt@redhat.com>
…fix downstream build Change-Id: I9eee44451b2ed41382cda9a446c47fc5c8f39e33 Signed-off-by: nickboldt <nboldt@redhat.com>
…to fix downstream build Change-Id: I9eee44451b2ed41382cda9a446c47fc5c8f39e33 Signed-off-by: nickboldt <nboldt@redhat.com>
…to fix downstream build Change-Id: I9eee44451b2ed41382cda9a446c47fc5c8f39e33 Signed-off-by: nickboldt <nboldt@redhat.com>
…to fix downstream build (#920) Change-Id: I9eee44451b2ed41382cda9a446c47fc5c8f39e33 Signed-off-by: nickboldt <nboldt@redhat.com>
…to fix downstream build (#920) Change-Id: Ic1ae2b8eac3b716e24e7c4ca2b255180f84b24f3 Signed-off-by: nickboldt <nboldt@redhat.com>
…to fix downstream build (#921) Change-Id: I9eee44451b2ed41382cda9a446c47fc5c8f39e33 Signed-off-by: nickboldt <nboldt@redhat.com>
…to fix downstream build Change-Id: I53108482296bec95f0109cfd15aa580973945f4b Signed-off-by: nickboldt <nboldt@redhat.com>
…to fix downstream build Change-Id: I53108482296bec95f0109cfd15aa580973945f4b Signed-off-by: nickboldt <nboldt@redhat.com>
…to fix downstream build (#935) Change-Id: I53108482296bec95f0109cfd15aa580973945f4b Signed-off-by: nickboldt <nboldt@redhat.com>
…quired See this for more - microsoft/TypeScript#29221
TypeScript Version: 3.2.2
Search Terms:
type symlink importHelpers pnpm
Code
https://github.com/stevefan1999-personal/gqlify/tree/patch-pnpm-tslib
Reproduction:
This is a little bit complicated, you will need to clone the repo I provided and checkout the branch, then run
pnpm install
, and then please flip theimportHelpers
options to false and re-run the installation again.Expected behavior:
When
importHelpers
is true, it shouldn't break type inference like we should whenimportHelpers
is false.Actual behavior:
When
importHelpers
is true and the @types directory is a symlink.Related Issues:
pnpm/pnpm#1375
Extra Stuff:
Although it is application-specific (Lerna with NPM/Yarn works fine on this), I do think this should be handled correctly regardless of any layers of symlinks.
PS:
tsc output observation diff: http://www.mergely.com/a6N4kOW3/
The text was updated successfully, but these errors were encountered: