Types for @hapi/joi
seem to be outdated - some configuration params mentioned in the official documentation are missing in the types. So I am trying to augment the types.
node_modules/@types/hapi__joi/index.d.ts:
declare namespace Joi {
...
interface ErrorFormattingOptions {...}
...
interface Root {...}
}
declare const Joi: Joi.Root;
export = Joi;
One of my .ts source files:
import joi from '@hapi/joi'
declare global {
namespace Joi {
interface ErrorFormattingOptions {
wrap?: {
label?: string | false
array?: string | false
}
}
}
}
That doesn't work
type R = Joi.ErrorFormattingOptions['']//autocomplete show only my 'wrap'
What is the proper way of augmentation in this case? Thanks.
UPDATE: Looks like that's impossible. Module '@hapi/joi'
has no named export ErrorFormattingOptions
. And in Typescript one cannot augment what's not exported