const fetch = flow(function *(url: string, options: RequestInit = {}) {
...
});
const create = (url: string, data: {}) => {
return fetch(url, {
body: JSON.stringify(data),
method: 'POST',
});
};
// [ts] Expected 1 arguments, but got 2.
// const fetch: (a1: string) => Promise<any>
Unfortunately known TS issue of not having variadic types :/
Got similar problem in flow(f) then I use an optional argument, fixed by removing ?...
loadM: flow(function* loadM(forceReload?: boolean) {
TS2554: Expected 0 arguments, but got 1.
Closing until variadic types :'(
Any workaround?
Reopening since now it has a PR
Any workaround?
You can declare "type" for arguments, example:
type Filter = {
id?: number
owner?: number
}
function* findOne(filter: Filter) {
...
}
Closing, a fix was released with mst 3.9
Most helpful comment
Got similar problem in
flow(f)then I use an optional argument, fixed by removing?...