Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mixing partial and type negates effects of partial #1170

Closed
hgezim opened this issue Feb 23, 2023 · 2 comments
Closed

Mixing partial and type negates effects of partial #1170

hgezim opened this issue Feb 23, 2023 · 2 comments

Comments

@hgezim
Copy link

hgezim commented Feb 23, 2023

Seems to me this test should work:

import { partial, string, number, type } from '../../../src'

export const Struct = partial(type({
  name: string(),
  age: number(),
}))

export const data = {
  name: 'john',
  c: 'doe'
}

export const output = {
  name: 'john',
  c: 'doe'
}

But it throws:

 1) superstruct
       validation
         partial
           valid-partial-type:
     Error: Expected "valid-partial-type" fixture not to throw an error but it did:

StructError: At path: c -- Expected a value of type `never`, but received: `"doe"`
      at Context.<anonymous> (test/index.ts:64:23)
      at processImmediate (node:internal/timers:476:21)
@dlindenkreuz
Copy link

Already reported here: #829

@arturmuller
Copy link
Collaborator

This has been resolved in #1149

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants