edgeguide / expect

Validates user input at runtime
MIT License
1 stars 0 forks source link

Add type inference to errors() #7

Closed marwankhalili closed 4 years ago

marwankhalili commented 4 years ago

It should be possible even for arrays. Fallback on any if the type inference fails.

Example of how the result could be:

expect(
  { foo: { type: 'object', keys: { bar: 'number' } } },
  { foo: { bar: 'test' } }
).errors(); // { foo?: string | { bar?: string } }
marwankhalili commented 4 years ago

Fixed in 150e429fac763adf97e478c152c6b7e585ededc0