Skip to content

Commit 5d7b32f

Browse files
alexvuongsf-tejas-nadkarni
authored andcommitted
Commerce react sdk strengthen some types (#3589)
* strenthen custom endpoint types and fix fetchOpts types errors
1 parent e193a2c commit 5d7b32f

File tree

4 files changed

+6
-5
lines changed

4 files changed

+6
-5
lines changed

packages/commerce-sdk-react/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
## v4.4.0-dev (Dec 17, 2025)
22
- [Bugfix]Ensure code_verifier can be optional in resetPassword call [#3567](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/3567)
3+
- [Improvement] Strengthening typescript types on custom endpoint options and fetchOptions types [#3589](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/3589)
34

45
## v4.3.0 (Dec 17, 2025)
56

packages/commerce-sdk-react/src/auth/index.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1184,7 +1184,7 @@ describe('Auth service sends credentials fetch option to the ShopperLogin API',
11841184
const configWithFetchOptions = {
11851185
...config,
11861186
fetchOptions: {
1187-
credentials: 'include'
1187+
credentials: 'include' as RequestCredentials
11881188
}
11891189
}
11901190
const auth = new Auth(configWithFetchOptions)
@@ -1213,7 +1213,7 @@ describe('Auth service sends credentials fetch option to the ShopperLogin API',
12131213
const configWithFetchOptions = {
12141214
...config,
12151215
fetchOptions: {
1216-
cache: 'no-cache'
1216+
cache: 'no-cache' as RequestCache
12171217
}
12181218
}
12191219
const auth = new Auth(configWithFetchOptions)

packages/commerce-sdk-react/src/hooks/helpers.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import Auth from '../auth'
88
import {CommerceApiProviderProps} from '../provider'
99
import {Logger} from '../types'
10-
import {OptionalCustomEndpointClientConfig, TMutationVariables} from './types'
10+
import {CustomEndpointArg, OptionalCustomEndpointClientConfig, TMutationVariables} from './types'
1111

1212
/**
1313
* A helper function for handling bad responses from SCAPI when an invalid access token is used.
@@ -37,7 +37,7 @@ export const generateCustomEndpointOptions = (
3737
config: Omit<CommerceApiProviderProps, 'children'>,
3838
access_token: string,
3939
args?: TMutationVariables
40-
) => {
40+
): CustomEndpointArg => {
4141
const globalHeaders = config.headers || {}
4242
const globalClientConfig = {
4343
parameters: {

packages/commerce-sdk-react/src/hooks/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ export type CacheUpdateMatrix<Client extends ApiClient> = {
216216
: never
217217
}
218218

219-
type CustomEndpointArg = Parameters<typeof helpers.callCustomEndpoint>[0]
219+
export type CustomEndpointArg = Parameters<typeof helpers.callCustomEndpoint>[0]
220220
type CustomEndpointArgClientConfig = CustomEndpointArg['clientConfig']
221221
// The commerce-sdk-isomorphic custom endpoint helper REQUIRES clientConfig as mandatory argument
222222
// But we inject the configs for users from the provider, so this custom type is created

0 commit comments

Comments
 (0)