0

I have a class function getMockSummaryData which returns a promise, now getting its return type I can do something like this type sample = ReturnType<FintechService['getMockSummaryData']>;, so the return type is something like Promise { data: somethingElse }, now my goal is to pick the data type of data, I have tried Pick<sample, 'data'> or even Pick<Promise<sample>, 'data'> but it does not work, it just gives me an error of TS2344: Type '"data"' does not satisfy the constraint 'keyof Promise { data: SummaryData[]; }>>'..

Any help would be highly appreciated here because my googling hasn't been very fruitful.

lulliezy
  • 1,741
  • 5
  • 24
  • 49

0 Answers0