Closed matiasgarcia closed 2 years ago
Hey @matiasgarcia! 👋🏻
Yes, you can extract the type from the validator schema.
export type JumioCallbackData = JumioCallbackValidator['schema']['props']
export default class JumioCallbackValidator {
public schema = schema.create({
idScanImage: schema.string.optional(),
idScanImageBackside: schema.string.optional(),
idScanImageFace: schema.string.optional(),
jumioIdScanReference: schema.string(),
merchantIdScanReference: schema.string(),
customerId: schema.string(),
})
public messages: CustomMessages = {}
}
Then, you can import JumioCallbackData
anywhere in your application.
@RomainLanz thanks a lot!
I am wondering if this is a feature request or if I plain TS should achieve this.
Let's say I have this validator
And in a Controller its used like this
Is it possible to get the return type of JumioCallbackValidator without calling it? For example, to use it in a service definition attribute.