-
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
Type resolution in linked packages #32970
Comments
If I'm not mistaken, this is incredibly annoying from our perspective, because as far as TS knows, you've loaded two copies of Now, I thought we already had some fancy logic that unified dependencies that were exactly the same version (and maybe we are) - it's possible that logic is missing a bit of code to propegate its gleaned knowledge of the project paths into the specifier generation process. |
@weswigham sorry can you clarify the following
Here I am getting the error from a src file that is part of This was not an issue in |
Somewhere in |
@simonfox can you try to compile adding in tsconfig.json:
After that, try to build. You should get the error,. Now, try to build again without remove the .tsbuildinfo file, and check if compiles correctly. I think this info can help us to find the real issue. For some reason, after have the .tsbuildinfo file, project compiles normally, but not in the first build. PS: Version used to reproduce this was 3.5.3 |
@nthypes I think that is just because you haven't made any changes between builds so the incremental build finds no work to do? |
Nope, because in the first try no |
@nthypes but this problem is in typings generation - you will get transpiled With |
This is happening to me as well
// my print.ts file
import chalk from 'chalk';
const colors = {
highlight: chalk.cyan,
info: chalk.blue,
debug: chalk.gray,
warning: chalk.yellow,
success: chalk.green,
error: chalk.red,
line: chalk.grey,
muted: chalk.grey,
};
export const print = {
colors,
}; // my cli.ts file
import { print } from '../print';
export class Toolbox {
// it fails here
public print = print;
} I did I ended up disabling |
@simonfox I am getting error trying to repro this when I try to install the dependencies:
|
The |
@sheetalkamat have updated the source as above |
Really hope this PR will fix this annoying issue. |
I'm using Typescript 3.7.5 and I'm still facing this issue. @weswigham mentioned:
That's pretty much what's going on for me. I have this Also, I can't set |
I still face this issue as well......the linked PR has fixed it in the repro I supplied however our app still suffers this issue. We still see the issue when the problematic package is at the same version across our linked packages. |
Actually I've just modified the repro slightly and it does still exhibit this problem. |
@simonfox This issue was fixed. Can you please open new issue with exact steps to repro the issue. We will investigate that one. Thanks |
This is essentially a duplicate issue however there has been no response on the existing issues which have been incorrectly closed so I am opening again.
Related issues:
#29221
#29808
Merged PR which hasn't resolved the issue:
#31571
Problem occurs when using
yarn link
for development purposes.Window 10 Pro v1903
Typescript 3.5.3
yarn 1.17.3
I've created a repro and described steps over on #29808 but basic steps are below
If you clone https://github.com/simonfox/repro-plugin-one and https://github.com/simonfox/repro-plugin-two and run
yarn
for both. Then runyarn link
in plugin two root, and then link one to the local two withyarn link plugin-two
from one. Then you will see the issue in src/features/feature-one/actions.ts (you may need to reload the VS Code window after linking).This results in
error TS2742: The inferred type of 'actions' cannot be named without a reference to 'drive-common/node_modules/typescript-fsa'. This is likely not portable. A type annotation is necessary.
UPDATE Should explicitly mention that this is in typings generation. With
"declaration": false
this error does not occur.The text was updated successfully, but these errors were encountered: