runtypes / runtypes

Runtime validation for static types

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Missing "Unknown" Record properties are ignored

johngeorgewright opened this issue · comments

If you were to create a Record with 1 Unknown property, it seems to be ignored during validation:

import { Record, Unknown } from 'runtypes'
const T = Record({ foo: Unknown })
console.info(T.check({}))
// {}

However, static typing would find this an error:

import { Static } from 'runtypes'
const test: Static<typeof T> = {}
// Property 'foo' is missing in type '{}' but required in type '{ foo: unknown; }'. ts(2741)

FWIW a related conversation is here: #113

Resolved in #113, please check it in v5.2.0.