Skip to content

[Bug] TS-first schemas allow stricter-than-needed checks #9

@thoughtspile

Description

@thoughtspile

When using TS-first collection schemas, the field validations can be stricter than the type passed:

array<string>(enums(['s']))
array<{ key: string }>(object({ key: string(), extra: string() }))
object<{ key: string }>({
  key: enums(['s'])
})

This never results in incorrect runtime values, but can make authoring and maintaining schemas a bit more daunting and cause false negatives. In the case of nested objects, I'm pretty sure there's no way to disallow extra keys with current TS.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions