googleapis / google-auth-library-nodejs

🔑 Google Auth Library for Node.js
Apache License 2.0
1.73k stars 381 forks source link

oauth2client.d.ts references non existant type "QueryStringInput" in querystring.d.ts #1817

Closed seanimamo closed 5 months ago

seanimamo commented 5 months ago

oauth2client.d.ts references a non existant type "QueryStringInput" in querystring.d.ts

produces the following error:

node_modules/google-auth-library/build/src/auth/oauth2client.d.ts:243:70 - error TS2724: '"querystring"' has no exported member named 'ParsedUrlQueryInput'. Did you mean 'ParsedUrlQuery'?

243     [key: string]: querystring.ParsedUrlQueryInput[keyof querystring.ParsedUrlQueryInput];

querystring.d.ts does infact not have this type after checking myself.

Environment details

Steps to reproduce

  1. install google auth library
  2. run tsc with the following tsconfig:
    {
    "compilerOptions": {
    "target": "ES2018",
    "module": "commonjs",
    "lib": [
      "es2018",
      "dom"
    ],
    "outDir": "build",
    "declaration": true,
    "strict": true,
    "noImplicitAny": true,
    "strictNullChecks": true,
    "noImplicitThis": true,
    "alwaysStrict": true,
    "noUnusedLocals": false,
    "noUnusedParameters": false,
    "noImplicitReturns": false,
    "noFallthroughCasesInSwitch": false,
    "inlineSourceMap": true,
    "inlineSources": true,
    "experimentalDecorators": true,
    "strictPropertyInitialization": false,
    "forceConsistentCasingInFileNames": true,
    },
    "exclude": [
    "node_modules",
    "node_modules/google-auth-library/*",
    "cdk.out"
    ]
    }
danielbankhead commented 5 months ago

I believe the issue is the missing Node.js types. Can you ensure @types/node has been installed locally?

seanimamo commented 5 months ago

It is, this is my package.json:

{
  "name": "unravell-engine",
  "version": "0.1.0",
  "scripts": {
    "build": "tsc",
    "watch": "tsc -w",
    "test": "jest --verbose false -c jest.config.js",
    "integration-test": "jest --verbose false -c jest.config.integration.js",
    "cdk": "cdk"
  },
  "devDependencies": {
    "@aws-sdk/client-s3": "^3.374.0",
    "@aws-sdk/credential-providers": "^3.370.0",
    "@aws-sdk/types": "^3.329.0",
    "@swc-node/jest": "^1.5.2",
    "@types/aws-lambda": "^8.10.97",
    "@types/bcryptjs": "^2.4.2",
    "@types/brotli": "^1.3.1",
    "@types/content-type": "^1.1.5",
    "@types/html-to-text": "^9.0.0",
    "@types/http-headers": "^3.0.0",
    "@types/jest": "^28.1.4",
    "@types/lodash": "^4.14.184",
    "@types/metaget": "^1.0.1",
    "@types/node": "10.17.27",
    "@types/node-gzip": "^1.1.0",
    "@types/prettier": "2.6.0",
    "@types/uuid": "^8.3.4",
    "axios": "^1.4.0",
    "esbuild": "^0.15.5",
    "jest": "^28.1.2",
    "jest-dynalite": "^3.5.1",
    "ts-node": "^10.7.0",
    "typescript": "^4.9.5"
  },
  "dependencies": {
    "@aws-sdk/client-cloudwatch": "^3.387.0",
    "@aws-sdk/client-cognito-identity-provider": "^3.549.0",
    "@aws-sdk/client-comprehend": "^3.316.0",
    "@aws-sdk/client-dynamodb": "^3.100.0",
    "@aws-sdk/client-sns": "^3.345.0",
    "@aws-sdk/util-dynamodb": "^3.100.0",
    "@stripe/stripe-js": "^1.54.1",
    "aws-cdk-lib": "^2.140.0",
    "bcryptjs": "^2.4.3",
    "brotli": "^1.3.3",
    "class-transformer": "^0.5.1",
    "constructs": "^10.0.0",
    "content-type": "^1.0.5",
    "dotenv": "^16.0.1",
    "google-auth-library": "^9.10.0",
    "http-headers": "^3.0.2",
    "lodash": "^4.17.21",
    "metaget": "^1.0.7",
    "reflect-metadata": "^0.1.13",
    "source-map-support": "^0.5.21",
    "stripe": "^12.10.0",
    "uuid": "^8.3.2"
  }
}
danielbankhead commented 5 months ago

"@types/node": "10.17.27" is pretty old (Node 10). Please update that package to at least v16 to align with the Node version in use.

seanimamo commented 5 months ago

That solved the problem. Thank you!