Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix Namespace 'Joi' has no exported member 'extractType'

Tags:

typescript

joi

I am extracting type from Joi schema using joi-extract-type. It has no compile time issue with @hapi/joi but when upgraded Joi to latest version of now (17.2.1). It does not understand extractType.

What could be simplest solution to get it fixed until it's typing is fixed at source?

One solution could be, providing this typing locally. Could anybody provide declaration for this or any other better solution?

export type dto = Joi.extractType<typeof schema>;

"joi": "^17.2.1",
"joi-extract-type": "^15.0.8",
like image 343
Irshad Ali Avatar asked Nov 25 '25 10:11

Irshad Ali


1 Answers

In express-joi-validation documantation you will find this note above 'joi-extract-type' exemple. NOTE: this does not work with Joi v16+ at the moment. Link for the issue.

If you want to use 'joi-extract-type' you must downgrade 'joi' below v16.

like image 83
Luiz Utzig Avatar answered Nov 27 '25 00:11

Luiz Utzig



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!