ResultT
See original GitHub issueI have the following problem using ResultT `import { BaseUseCase, IResultT, ResultT } from “./base/BaseUseCase” import { IPatientRepository, IPatient } from “@umahealth/repositories-module”
export class FindPatientUseCase extends BaseUseCase { constructor(private readonly PatientRepository: IPatientRepository) { super() } async execute(uid: string, patient: IPatient): Promise<IResultT<IPatient>> { const result = new ResultT() const patientExists: IPatient = await this.PatientRepository.getByUid(uid) result.setData(patientExists, 200) return result } }`
it says
Type 'Result<unknown>' is not assignable to type 'IResult<IPatient>'. Types of property 'data' are incompatible. Type 'unknown' is not assignable to type 'string | IPatient'. Type 'unknown' is not assignable to type 'IPatient'
I’m failling to understand how to properly use this library. Could you please give me some guidance?
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (3 by maintainers)
Top GitHub Comments
thanks! yeah, everything just fell into place afterwards. I was struggling at first with incorporating the whole framework into my head, but I fell that I’m now able to extract the most value out of this template. This is a very nice project, congrats!!
I’ve just solved it… ajjajajjaajaja sry to bother just for anyone else looking for this, you declare result like so. const result = new ResultT<IPatient>()