TCMiranda / joi-extract-type

Provides native type extraction from Joi schemas for Typescript
MIT License
151 stars 27 forks source link

Infer an union from object.pattern schema #7

Closed TCMiranda closed 5 years ago

TCMiranda commented 5 years ago
const stringDict = Joi.object().pattern(//, Joi.string());
type s1 = typeof stringDict; // { [key: string]: string }

const numberStringDict = stringDict.pattern(//, Joi.number());
type s2 = typeof numberStringDict; // { [key: string]: (string | number) }