I know I've solved this before, but perhaps the landscape has changed since then. I'm trying to setup a new project primarily using fastify, coding in VSCode in TypeScript and managing dependencies with Yarn2.
VSCode is telling me it cannot find fastify. It also cannot find Node types despite adding both fastify and @types/node. I've tried numerous permutations and steps of the following, insured I'm using the VSCode workspace version of TypeScript, revised the tsconfig.json to use node moduleResultion, etc. Whatever used to work doesn't work anymore, but I haven't found a single other current post or bit of documentation that resolves the issue.
What am I missing?
nvm install node ## Install latest NodeJS
node --version > .nvmrc ## Set the node version to use
yarn init -y ## Project initialization
yarn set version berry ## Use yarn v2
yarn add --dev typescript ## TypeScript all the way
yarn add --dev ts-node ## Easier Ts script or task execution
yarn plugin import typescript ## Magic?
yarn add --dev @types/node ## Node types
yarn add --dev @yarnpkg/pnpify ## Emulate ./node_modules
yarn pnpify --sdk vscode ## Setup workspace/environment
yarn tsc --init -t ES2020 ## Generate tsconfig.json
yarn add fastify ## Add fastify dep
package.json
{
"name": "server",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"devDependencies": {
"@yarnpkg/pnpify": "^2.2.1",
"ts-node": "^9.0.0",
"typescript": "^4.0.3"
},
"dependencies": {
"fastify": "^3.4.1"
}
}
Update: Despite answering VSCode's prompt to use the workspace version of TypeScript, I found that I still need to manually specify it via ctrl+shift+p > Select TypeScript version... After doing that, the problem changes a bit. Regardless of the import statement, I now see namespace issue:


