Portkey-AI / portkey-node-sdk

Build reliable, secure, and production-ready AI apps easily.
https://portkey.ai/docs
22 stars 8 forks source link

[Bug]: Spread types may only be created from object types #130

Open vladb opened 2 weeks ago

vladb commented 2 weeks ago

What happened?

Getting the following error with portkey-node-sdk 1.5.1, 1.5.0, 1.4.0 (possibly below as well, haven't checked).

node_modules/portkey-ai/dist/src/baseClient.ts:60:7 - error TS2698: Spread types may only be created from object types.

60       ...(await response.json()),
         ~~~~~~~~~~~~~~~~~~~~~~~~~~

Version

0.1.xx (Default)

Relevant log output

No response

Code of Conduct

vladb commented 2 weeks ago

using typescript 5.6.2

csgulati09 commented 2 weeks ago

Hey! Thanks for raising the issue. Just wanted to know what is your tsconfig.json? This bit of code seems to be unchanged for a while now. Not sure how this issue is showing up now.

vladb commented 2 weeks ago

Hey, thanks for getting back.

Here's my tsconfig.json:

{
  "compilerOptions": {
    "esModuleInterop": true,
    "skipLibCheck": true,
    "target": "es2022",
    "allowJs": true,
    "resolveJsonModule": true,
    "moduleDetection": "force",
    "isolatedModules": true,
    "verbatimModuleSyntax": false,

    "strict": true,
    "noUncheckedIndexedAccess": false,
    "noImplicitOverride": true,
    "noImplicitAny": false,

    "module": "NodeNext",
    "outDir": "dist",
    "sourceMap": true,

    "lib": ["es2022"]
  },
  "exclude": ["generated/**/*"]
}
csgulati09 commented 1 week ago

Hey! So this was coming because of the latest TS package and the user's tsconfig. Which is understandable. I have done a simple fix for the issue. Will be raising a PR against it and making a release for it soon. Thanks for pointing this one out.