hjkcai / typesafe-joi

A fork of joi that produces typed validation results in TypeScript
MIT License
73 stars 9 forks source link

Inference bug with typesafe-joi 3.0.5 / TypeScript 3.5 #19

Closed bard closed 5 years ago

bard commented 5 years ago
import Joi from 'typesafe-joi'

const schema = Joi.object().keys({
  receiveUpdates: Joi.boolean().required()
})

const value = Joi.attempt({}, schema)

/* type of value:

const value: ({} & {
    [x: string]: string | number | boolean | ({
        [x: string]: string | number | boolean | (... & {
            [x: string]: string | number | boolean | (... & ...) | null | undefined;
        }) | null | undefined;
    } & {
        [x: string]: string | ... 4 more ... | undefined;
    }) | null | undefined;
}) | undefined

*/

type T = Joi.Literal<typeof schema>

/* type of T: any */
hjkcai commented 5 years ago

Thanks @brad

However it seems fine. I cannot reproduce this issue. Could you please try to reinstall everything?

Screen Shot 2019-06-08 at 2 42 11 PM
bard commented 5 years ago

Well, beats me, I did everything in a minimal repro to be certain and now I cannot reproduce it either. Apologies for the noise and thanks for your patience.