R
Reactiflux

autoimports of react or next in vscode

autoimports of react or next in vscode

PBpurple black1/23/2023
I've got a nextjs project with framer motion. Every time I want to import react hook I can’t just type useState and press control + space for import suggestions, I get only snippets suggestions when tooltip shows up. In the contrary when I try to use a hook from framer motion library I get all available suggestions for its imports. I’m using typescript
Here’s package json ": { "@mdx-js/loader": "^2.2.1", "@mdx-js/react": "^2.2.1", "@next/font": "13.1.1", "@next/mdx": "^13.1.1", "@types/node": "18.11.18", "@types/react": "18.0.26", "@types/react-dom": "18.0.10", "clsx": "^1.2.1", "eslint": "8.31.0", "eslint-config-next": "13.1.1", "framer-motion": "^8.3.4", "gray-matter": "^4.0.3", "next": "13.1.1", "react": "18.2.0", "react-dom": "18.2.0", "sass": "^1.57.1", "typescript": "4.9.4" } Tsconfig compilerOptions": { "target": "es5", "lib": ["dom", "dom.iterable", "esnext"], "allowJs": true, "skipLibCheck": true, "strict": true, "forceConsistentCasingInFileNames": true, "noEmit": true, "esModuleInterop": true, "module": "esnext", "moduleResolution": "node", "resolveJsonModule": true, "isolatedModules": true, "jsx": "preserve", "incremental": true }, "include": ["next-env.d.ts", "/*.ts", "/*.tsx"], "exclude": ["node_modules"]
Solution:
VSCode - restart TS server command helped
Jump to solution
UUUnknown User1/23/2023
5 Messages Not Public
Sign In & Join Server To View
PBpurple black1/23/2023
Thanks I'll let you know tomorrow if it worked
UUUnknown User1/23/2023
Message Not Public
Sign In & Join Server To View
Solution
PBpurple black1/24/2023
VSCode - restart TS server command helped
UUUnknown User1/24/2023
2 Messages Not Public
Sign In & Join Server To View
PBpurple black1/24/2023
I tested the project on two computers One has 8gb of ram and 8 years old Intel CPU Other one has 32 gb of ram and Ryzen 3700 Import suggestions worked on the faster one so I guessed that something has to be wrong with memory of types in TypeScript on the slower machine. I guess because of certain RAM optimizations TS sometimes drops some types from memory
UUUnknown User1/24/2023
Message Not Public
Sign In & Join Server To View
PBpurple black1/24/2023
One gave me idea that something can be wrong with TS
UUUnknown User1/25/2023
2 Messages Not Public
Sign In & Join Server To View

Looking for more? Join the community!

R
Reactiflux

autoimports of react or next in vscode

Join Server