I want to pass action.url string as a parameter of topicDummy function which return Promise, but It keeps show me
No overload matches this call.
The last overload gave the following error.
Argument of type '<TopicData>(url: string) => Promise<TopicData>' is not assignable to parameter of type '{ context: unknown; fn: (this: unknown, ...args: any[]) => any; }'.
Type '<TopicData>(url: string) => Promise<TopicData>' is missing the following properties from type '{ context: unknown; fn: (this: unknown, ...args: any[]) => any; }': context, fnts(2769)
effects.d.ts(499, 17): The last overload is declared here.
these are my whole codes.
export type TopicData = {
name: TopicName
data: CardData[]
}
const dummyTopicData: TopicData = Object.assign({
topic: 'etc',
data: dummyData()
}, )
function topicDummy<TopicData>(url: string): Promise<TopicData> {
return new Promise((resolve, reject) => {
setTimeout(() =>
dummyTopicData
, 700);
})
}
function* fetchTopic(action: DispatchAction){
try{
yield put(topicCreator.load());
const topicList = yield call(topicDummy, action.url); // <- complain here.
yield put(topicCreator.success(topicList));
} catch(error){
throw new Error(`Error exist in fetchTopic function`);
}
}