ScaleLeap / selling-partner-api-sdk

A fully typed TypeScript and Node.js SDK library for Amazon Selling Partner API
https://npm.im/@scaleleap/selling-partner-api-sdk
MIT License
68 stars 28 forks source link

having all kinds of typescript linting issues #215

Closed ohabash closed 3 years ago

ohabash commented 3 years ago

I dont think it has much to do with your plugin but im hoping someone might know why my tsc compiler is freaking out.

when i try to compile my modules which has import { SellersApiClient } from "@scaleleap/selling-partner-api-sdk"; in it. I get several errors like the following.

.../src/modules/amazon-sp-api/lib/typings/index.d.ts:96:16 - error TS2665: Invalid module name in augmentation. Module 'amazon-sp-api' resolves to an untyped module at '.../node_modules/amazon-sp-api/index.js', which cannot be augmented.

.../src/modules/amazon-sp-api/lib/typings/index.d.ts:100:5 - error TS1040: 'async' modifier cannot be used in an ambient context.

.../src/modules/amazon-sp-api/lib/typings/index.d.ts:98:34 - error TS1093: Type annotation cannot appear on a constructor declaration.

my tsconfig

{
  "compilerOptions": {
    "target": "es6",
    "module": "commonjs",
    "moduleResolution": "node",
    "allowSyntheticDefaultImports": true,
    "allowJs": true,
    "importHelpers": true,
    "jsx": "react",
    "alwaysStrict": true,
    "sourceMap": true,
    "forceConsistentCasingInFileNames": true,
    "noFallthroughCasesInSwitch": true,
    "noImplicitReturns": true,
    "noUnusedLocals": true,
    "noUnusedParameters": true,
    "noImplicitAny": false,
    "noImplicitThis": false,
    "strictNullChecks": false,
    "resolveJsonModule": true,
    "lib": [
      "es2018",
      "dom"
    ]
  },
  "exclude": [
  ],
  "include": [
    // "src/**/*",
    // "src/public/**/*",
    "__tests__/**/*",
    "src"
  ]
}

some versions version

npx tsc -v Version 4.3.5

npx typescript -v Version 4.3.5

npm tsc -v 6.9.0

npm typescript -v 6.9.0

npx @types/node -v v10.16.3

npm @types/node -v 6.9.0

node -v v10.16.3

package.json

{
  "name": "****",
  "version": "0.0.0",
  "author": "****",
  "license": "Apache-2.0",
  "description": "***",
  "engines": {
    "node": "10.16.3"
  },
  "scripts": {
    "tsc": "./node_modules/.bin/tsc",
    "tscv": "./node_modules/.bin/tsc -v",
    "clean": "rimraf coverage build tmp",
    "build1": "tsc -p tsconfig.release.json",
    "build:watch": "tsc -w -p tsconfig.release.json",
    "dev": "./node_modules/.bin/tsc -w -p tsconfig.release.json",
    "dev2": "nodemon build/src/server.js",
    "dev_debug": "nodemon --inspect=0.0.0.0:9229 build/src/server.js",
    "lint": "tslint -t stylish --project \"tsconfig.json\"",
    "test": "jest --coverage",
    "test:watch": "jest --watch",
    "start": "node src/server.js",
    "startDev": "nodemon build/src/server.js",
    "copy_public": "cp -r src/public build/src/",
    "git": "open https://github.com/ohabash/fornida-api",
    "heroku:restart": "heroku restart -a fornida-api"
  },
  "devDependencies": {
    "@types/bluebird-global": "^3.5.12",
    "@types/cron": "^1.7.2",
    "@types/express": "^4.17.11",
    "@types/jest": "^24.0.18",
    "@types/mongoose": "^5.7.36",
    "@types/node": "^10.14.17",
    "jest": "~24.9.0",
    "prettier": "~1.18.2",
    "rimraf": "^3.0.0",
    "ts-jest": "^24.0.0",
    "tslint": "6.1.3",
    "tslint-config-prettier": "1.18.0",
    "tslint-microsoft-contrib": "~6.2.0",
    "tsutils": "~3.17.0",
    "typescript": "^4.1.5"
  },
  "dependencies": {
    "@scaleleap/selling-partner-api-sdk": "^5.0.0",
    "@types/multer": "^1.4.5",
    "amazon-sp-api": "^0.3.7",
    "ansi-to-html": "^0.6.14",
    "async": "^3.2.0",
    "axios": "^0.19.2",
    "bluebird": "^3.7.2",
    "body-parser": "^1.19.0",
    "bson": "^4.1.0",
    "cheerio": "^1.0.0-rc.3",
    "colors": "^1.3.3",
    "cors": "^2.8.5",
    "cron": "^1.8.2",
    "csv": "^5.3.2",
    "dotenv": "^8.2.0",
    "express": "^4.17.1",
    "express-winston": "^4.0.5",
    "firebase-admin": "^8.9.2",
    "fs": "0.0.1-security",
    "json2csv": "^4.5.3",
    "lodash.orderby": "^4.6.0",
    "moment": "^2.27.0",
    "mongodb": "^3.6.2",
    "mongoose": "^5.10.11",
    "morgan": "^1.9.1",
    "mssql": "^6.2.3",
    "multer": "^1.4.2",
    "node-cron": "^2.0.3",
    "ora": "^4.0.2",
    "path": "^0.12.7",
    "pg": "^7.15.1",
    "promise": "^8.0.3",
    "read-last-lines": "^1.7.2",
    "request": "^2.88.0",
    "request-promise": "^4.2.4",
    "resource-router-middleware": "^0.7.0",
    "rxjs": "^6.5.4",
    "socket.io": "^2.3.0",
    "tough-cookie": "^3.0.1",
    "tslib": "~1.10.0",
    "unirest": "^0.6.0",
    "winston": "^3.3.3",
    "winston-mongodb": "^5.0.5",
    "yargs": "^14.2.0"
  }
}
moltar commented 3 years ago

But amazon-sp-api is not our module?

Please post output from:

npm ls amazon-sp-api
ohabash commented 3 years ago

oops. you are correct. Your module works great. Thank you.