Skip to content

Using forward and partialCheck like the password compare example results in multiple type errors #987

@matthew-dean

Description

@matthew-dean

Reproduction example here

const FormSchema = pipe(
  object({
    password: pipe(string(), minLength(6), maxLength(18)),
    confirmPassword: string(),
  }),
  forward(
    partialCheck(
      [['password'], ['confirmPassword']],
      (input) => input.password === input.confirmPassword,
      'The two passwords do not match.'
    ),
    ['confirmPassword']
  )
);

I don't get errors in TypeScript language services, but the reproduction example fails to compile in tsc / vue-tsc.

The two errors are:

  • error TS2589: Type instantiation is excessively deep and possibly infinite.
  • error TS2339: Property 'confirmPassword' does not exist on type '{ password: string; }'

Metadata

Metadata

Assignees

Labels

questionFurther information is requested

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions