Visitar URL original
Joi.object<Type, Strict, Type>(....), the purpose of last Type and its presence prevents property autocomplete · Issue #3090 · hapijs/joi · GitHub
Skip to content

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

Open

Description

@skiv71

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?

const some = 'properly formatted code example';

Activity

  1. added
    supportQuestions, discussions, and general support
    on Sep 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    supportQuestions, discussions, and general support

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions