-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ResultT #5
Comments
I've just solved it... ajjajajjaajaja sry to bother |
Hi @gocandra result can be use with type ResultT (IResultT) o without type Result (IResult) const result = new ResultT<YourType>(); Without type const result = new Result(); I hope this gives you more clarity about the use of this package. |
@gocandra in this line, you can use the statusCode using Clean Code: result.setData(patientExists, this.applicationStatus.SUCCESS,) If you need create more aplication status codes, so you can map this status codes into the file StatusMapping in path: |
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!! |
Thanks @gocandra, but don't forget to leave your star. It's a way to move the project forward and a form of support. ^^ |
I 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> {
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?
The text was updated successfully, but these errors were encountered: