Yup 0.32.0+ doesn't work with basic types - a workaround?

Viewed 126

Since version 0.32 of Yup validation library, it's not anymore possible to define a basic schema like:

import yup from "yup";

interface LoginItem {
  loginName: string;
  password: string;
}

yup.object().defined().shape<LoginItem>({
  loginName: yup.string().defined(),
  password: yup.string().defined()
});

and have it compiled due to a TypeScript error:

Index signature is missing in type 'LoginItem'

Sandbox: https://codesandbox.io/s/adoring-chandrasekhar-7rywp?file=/src/test.ts

I couldn't find a workaround or a fix for this problem.

P.S. As it looked like a bug, I filed a detailed report in the issue queue but it was closed w/o any resolution or helping references.

0 Answers
Related