Skip to content

@my-swu/simulator-client


@my-swu/simulator-client / FetchLike

Type Alias: FetchLike ​

FetchLike = typeof fetch

Defined in: packages/ts-sdk/src/internal/transport.ts:21

Fetch implementation accepted by the SDK.

Browser runtimes and Node 18+ usually provide this globally. Pass a custom value when your runtime needs a fetch adapter, proxy wrapper, or test double.

Example:

ts
import type { FetchLike } from '@my-swu/simulator-client'

const fetchLike: FetchLike = globalThis.fetch.bind(globalThis)

console.log(fetchLike)

Example ​

ts
import type { FetchLike } from '@my-swu/simulator-client'

const tracedFetch: FetchLike = (input, init) => {
  console.log('SDK request', input)
  return fetch(input, init)
}

console.log(typeof tracedFetch)

See ​

https://simulator-sdk.my-swu.com/guide/runtime-adapters

Released under the MIT License.