#3090·joi

Joi.object<Type, Strict, Type>(....), the purpose of last Type and its presence prevents property autocomplete

Author: skiv71Created Sep 28, 2025Updated Sep 28, 2025
Labelssupport

Runtime

node.js

Runtime version

18.0.1

Module version

?

Used with

standalone

Any other relevant information

Hi, when using Joi.object with a generic TSchema, I only get autocomplete for my Types fields if I include it as follows: -

Joi.object<Type, false / true, Type>.

I checked the source...

// tslint:disable-next-line:no-unnecessary-generics object<TSchema = any, isStrict = false, T = TSchema>( schema?: SchemaMap<T, isStrict> ): ObjectSchema;

It appears as if T should revert to the passed TSchema and be used, but it doesn't seem to.

I hacked (sorry) the package (in situ) to <TSchema, isStrict> and removed / replaced references to T and all is well.

Am I missing something?

Kind regards,

Neil

How can we help?

javascript
const some = 'properly formatted code example';