#Sudden errors in project around NodeJS process object?

21 messages · Page 1 of 1 (latest)

teal hamlet
#

Hey folks, just opened my project this morning and all of a sudden it's full of errors for anything on process, e.g.

Property 'exit' does not exist on type '{ argv: never[]; env: {}; }'.

22     if (!go) process.exit()
Property 'CI' does not exist on type '{}'.

12   forbidOnly: Boolean(process.env.CI),
                                    ~~

I'm not so much looking for a fix for those errors so much as an understanding of why this just started happening all of a sudden one day? I have not done any npm installs, changed no versions, simply opened up my project and both in VSC and tsc there are now errors around process. wat.

#
{
  "extends": "astro/tsconfigs/strict",
  "compilerOptions": {
    "baseUrl": ".",
    "paths": {
      "~/*": ["src/*"],
      "@trpc/react-query/dist/shared": ["node_modules/@trpc/react-query/dist/shared"]
    },
    "jsx": "react-jsx",
    "jsxImportSource": "react",
    "verbatimModuleSyntax": false
  }
}

cloud zenith
#

It shouldn't have changed for no reason.

#

So clearly something changed; not sure what it would be.

#

If you dig in and find out where the bad typings are coming from maybe that help clarify things.

teal hamlet
#

I got a VS Code update to 1.85.2 but the changelog says nothing about that, plus it breaks tsc too

#

Just so odd, no exit method, no nothing

#

Go to definition goes to the right file node_modules/@types/node/process.d.ts

#

I can see all the missing methods in that file too

cloud zenith
#

It only shows one location to go to? Even if you like "peek definitions" or whatever?

teal hamlet
#

Two spots for peek but both look right

#

But, trying this in a d.ts file does not add foo to env

declare global {
  namespace NodeJS {
    interface ProcessEnv {
      foo: string
    }
  }
}
#

So like. What.

#

Maybe I'll restart my mac lol

#

I suppose that was wishful thinking

#

Wait no, that did work. The error I saw after the reboot was a test

#

wtaf

cloud zenith
#

Did you try "Resart TS Server" before rebooting?

teal hamlet
#

Yeah one of the first things

cloud zenith
#

Yeah, not sure then.

teal hamlet
#

I appreciate your time 🙏