You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(createApi): better types
`createApi().[method]` has better type support for inferring `ctx`
properties.
```ts
import { createApi } from 'saga-query';
interface Props { id: string }
interface Success { result: string }
interface Err { message: string }
const api = createApi();
const fetchUser = api.get<Props, Success, Err>(
'/users/:id',
function*(ctx, next) {
// will be set to `Props`
ctx.payload;
yield next();
if (ctx.json.ok) {
// will be set to `Success`
ctx.json.data;
} else {
// will be set to `Err`
ctx.json.data;
}
},
);
dispatch(fetchUser({ id: '1' }));
```