-
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
Refactor: move to new file does not work #59650
Comments
tsconfig.json: {
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"resolveJsonModule": true,
"outDir": "./dist/",
"lib": ["es2018", "dom", "ES2020.Promise", "DOM.Iterable", "es2019.array", "ES2021.String"],
"sourceMap": true,
"strict": true,
"module": "esnext",
"jsx": "react-jsx",
"target": "es2017",
"rootDir": ".",
"allowJs": true,
"moduleResolution": "node",
"noUnusedLocals": true,
"noUnusedParameters": true,
"esModuleInterop": true,
"skipLibCheck": true,
"downlevelIteration": true,
"importHelpers": true,
"experimentalDecorators": true,
"preserveSymlinks": true,
"useUnknownInCatchVariables": false,
// COPY: /webpack/tsconfig.json
// COPY: /webpack/webpack.base.config.ts#alias
// COPY: /.storybook/main.ts
"paths": {
"@proterm/core": ["./src/core"],
"@terminal/*": ["./src/*"]
},
"plugins": [
{
"name": "typescript-plugin-css-modules",
"options": {
"customMatcher": "\\.less$"
}
}
]
},
"types": ["node", "jest", "@testing-library/jest-dom", "@testing-library/react"],
"include": ["./src/"],
"exclude": ["**/__tests__", "**/*.stories.*", "**/__mock__/*.ts", "**/node_modules", "**/lib"]
} |
So, @proterm/core is an alias to the big file with re-exports and re-exports of re-exports Moreover, function selectStore<State>(store: ReducerStore<State>): (state: any) => State;
function selectStore<State>(store: ReducerStore<State>, state: any): State;
function selectStore<State>(store: ReducerStore<State>, state?: any) {
if (state) {
return select(store, state);
}
function selectStoreCurried(stateCurried: State) {
return select(store, stateCurried);
}
(selectStoreCurried as any)[widgetScope.symbol] = true;
return selectStoreCurried;
}
(selectStore as any)[widgetScope.symbol] = true;
export default selectStore; |
Looks like this is a problem, because import { syncSettings } from '@proterm/core';
export function useOrders() {
return syncSettings;
} works as syncSettings hasn't multiple declarations. In the save moment, I cannot move other functions w/o referring import { useCallback, useRef, useState } from 'react';
import { useLatest } from 'react-use';
type Opts = { lastOnly?: boolean };
type Set<D> = (data: D) => void;
export function useSubscriptionProvider<T extends Set<D>, D>(name: string, data: D, opts?: Opts) {
const { lastOnly = true } = opts || {};
const [buffer, setBuffer] = useState<D[]>([]);
const queueRef = useLatest(buffer);
const saveBuffer = useCallback((data: D) => setBuffer((q) => [...q, data]), []);
const ref = useRef<T>();
console.log('hm', { lastOnly, buffer, queueRef, saveBuffer, ref, name, data });
} Currently problem is a Minimal not working example: import { useLatest } from 'react-use';
export function useUseLatest (data: string) {
return useLatest(data);
} |
I'm seeing this issue too. When I try to Move to a New File in vscode, the following errors appear in the Extension Host output.
|
@navya9singh any update on this? |
@navya9singh @aureliopetrone @sheetalkamat this looks like the fix for a similar issue however it's I have just downloaded the newest version and it doesn't seem to work for me. Additionally there is some comments about disabling/enabling "typescript.tsserver.experimental.useVsCodeWatcher". I have tried both enabled and disabled but neither resolves for me |
This seems more or less duplicate of #58740 |
I can confirm that this bug is still present & refactoring is broken for several minor & fix versions. Any plans to fix this? |
Any news on this? Also getting this when trying to move almost any symbols to a new file:
|
Does this issue occur when all extensions are disabled?: Yes
Steps to Reproduce:
What I tried already:
--disable-extensions
to ensure it's not a problem with a package.typescript.tsserver.enableTrace
It worked a few versions before. I don't know exactly what version was okay.
UPD: not working:
not working:
not working:
working:
working:
working:
I though @ import aliases is a problem, however this works too:
error:
The text was updated successfully, but these errors were encountered: