SDK types found but empty, and autocompletion not working
babgyy opened this issue · 5 comments
Context
I am using v6.0.3 of the SDK, and am trying to use the storefront checkout methods.
The code works, but type definitions are listed as any
, and autocompletion does not work.
This sample for instance won't find type informations for checkout
and orderUpdate
import createFetchFetcher from '@spree/node-fetcher';
import { makeClient } from '@spree/storefront-api-v2-sdk';
const client = makeClient({
host: `https://example.com/spree/`,
createFetcher: createFetchFetcher,
});
const response = await client.checkout.orderUpdate({});
Expected Behavior
I am no typescript expert, but I think types should be inferred.
Typing
client.
should/could suggest autocompletions for method of the interface Client
such as Checkout and so on ?
This was working in a previous project using v4 of this SDK
Possible Fix
No idea
Your Environment
I am using VSCode
"dependencies": {
"@apollo/client": "^3.7.6",
"@hookform/resolvers": "^2.9.11",
"@lingui/react": "^3.17.0",
"@segment/analytics-next": "^1.51.1",
"@spree/node-fetcher": "^1.0.0",
"@spree/storefront-api-v2-sdk": "^6.0.3",
"@types/humps": "^2.0.2",
"date-fns": "^2.29.3",
"graphql": "^16.6.0",
"humps": "^2.0.1",
"lodash": "^4.17.21",
"lottie-react": "^2.4.0",
"marked": "^4.2.12",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-hook-form": "^7.43.1",
"react-router-dom": "^6.8.0",
"react-scripts": "5.0.1",
"survey-core": "^1.9.74",
"survey-react-ui": "^1.9.71",
"tailwindcss": "^3.2.4",
"typescript": "^4.9.4",
"web-vitals": "^2.1.4",
"wretch": "^2.4.1",
"zod": "^3.20.6",
"zustand": "^4.3.2"
},
If it can help, I have reproduced the issue with a minimal setup on stackblitz here :
https://stackblitz.com/edit/typescript-whunwk?file=index.ts
@babgyy Thank you for your help! We have identified the issue and I'm working on it.
@babgyy Hi! You can now bump the SDK's version to v6.0.4 and autocompletion should work. In VS Code you might also need to restart the Typescript server.