title: How to setup TypeScript, VScode, Yarn2, Fastify project
body: <p>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.</p>
  <p>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.</p>
  <p>What am I missing?</p>
  <pre><code>nvm install node               ## Install latest NodeJS
  node --version &gt; .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
  </code></pre>
  <p><a href="https://i.stack.imgur.com/riIMf.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/riIMf.png" alt="enter image description here" /></a></p>
  <p><a href="https://i.stack.imgur.com/zs1ia.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/zs1ia.png" alt="enter image description here" /></a></p>
  <p>package.json</p>
  <pre><code>{
    &quot;name&quot;: &quot;server&quot;,
    &quot;version&quot;: &quot;1.0.0&quot;,
    &quot;main&quot;: &quot;index.js&quot;,
    &quot;license&quot;: &quot;MIT&quot;,
    &quot;devDependencies&quot;: {
      &quot;@yarnpkg/pnpify&quot;: &quot;^2.2.1&quot;,
      &quot;ts-node&quot;: &quot;^9.0.0&quot;,
      &quot;typescript&quot;: &quot;^4.0.3&quot;
    },
    &quot;dependencies&quot;: {
      &quot;fastify&quot;: &quot;^3.4.1&quot;
    }
  }
  </code></pre>
  <p>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 &gt; Select TypeScript version...  After doing that, the problem changes a bit.  Regardless of the import statement, I now see namespace issue:
  <a href="https://i.stack.imgur.com/V8fi4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/V8fi4.png" alt="enter image description here" /></a></p>