hapijs / hapijs/joi

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

Open
#3,090 0 comments 0 reactions 0 assignees View on GitHub
support
Dominant language
JavaScript
Stars
21.2k
Forks
1.5k
Avg merge
4h 57m
Merged PRs (30d)
14

Description

### 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.

I checked the source...

// tslint:disable-next-line:no-unnecessary-generics
object(
schema?: SchemaMap
): 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 and removed / replaced references to T and all is well.

Am I missing something?

Kind regards,

Neil

### How can we help?

```js
const some = 'properly formatted code example';
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.