danger / danger-js

⚠️ Stop saying "you forgot to …" in code review
http://danger.systems/js/
MIT License
5.22k stars 363 forks source link

[BUG] Upgrading to danger `11.3.0` causes `tsc` build errors #1407

Closed n-tucker closed 3 months ago

n-tucker commented 9 months ago

Describe the bug We recently have a version bump for danger suggested to us via renovate. Our GHA tests fail on the build step, which seems to suggest that something has changed within the gitbeaker version bump specified in the changelog

To Reproduce Steps to reproduce the behavior:

  1. Use a Typescript project with danger 11.2.8
  2. Bump danger to 11.3.0
  3. Run tsc

Expected behavior No errors should occur. I can confirm this by switching to a branch without the version bump, running tsc works without issues image

Config shouldn't need to be changed for a non-major version release

Screenshots

Build error in GHA image

Build error on local Mac image

Confirmation that the errors in question are coming from danger image

Your Environment

software version
danger.js 11.3.0
node 16.20.2
npm 8.19.4
Operating System Ubuntu 22.04.3 LTS

Additional context As shown in the second screenshot, I'm also able to reproduce this locally on my Mac (M1 Pro, Ventura 13.6).

If there's some sort of workaround in tsconfig.json I can implement I'm also happy to hear about that too! TIA for any assistance!

fbartho commented 9 months ago

What typescript version are you running? And yes, if you can share your tsconfig that might help! Depending on versions of TypeScript, various global types are added/removed in the base config.


Blob I think is a JS global in browsers, but it might not be a global in nodejs, or not a global in all of TypeScript’s current build targets.

Further, the issue is coming a dependency node_modules/@gitbreaker which is really annoying.

n-tucker commented 9 months ago

Thanks so much for the quick reply! 🙏

We're using version 5.2.2 of Typescript, here's our tsconfig.json:

{
  "compilerOptions": {
    "target": "ES2018",
    "module": "commonjs",
    "lib": ["es2016", "es2017.object", "es2017.string"],
    "esModuleInterop": true,
    "declaration": true,
    "strict": true,
    "noImplicitAny": true,
    "strictNullChecks": true,
    "noImplicitThis": true,
    "alwaysStrict": true,
    "noUnusedLocals": false,
    "noUnusedParameters": false,
    "noImplicitReturns": true,
    "noFallthroughCasesInSwitch": false,
    "inlineSourceMap": true,
    "inlineSources": true,
    "experimentalDecorators": true,
    "strictPropertyInitialization": false,
    "resolveJsonModule": true
  },
  "exclude": ["parameter-store", "cdk.out"]
}

LMK if you need any more info! Thanks again!

snowe2010 commented 9 months ago

I had this error the other day. I am pretty sure I solved it by installing @types/node. I think I might have needed to install it globally at that, which was weird.

fbartho commented 9 months ago

@n-tucker definitely check out @types/node — this really sounds familiar to something I resolved in one of my projects a couple years ago! I think it was something like adding @types/node or a different polyfill patch.