plantain-00 / type-coverage

A CLI tool to check type coverage for typescript code
MIT License
1.2k stars 43 forks source link

Incompatibility with zod schemas #134

Closed molinch closed 5 months ago

molinch commented 5 months ago

First of all thanks for the awesome library, this truly helps us to achieve high quality in our TS projects.

Version: v2.27.1

Environment: Windows and Linux

Code:

const someSchema = z.object({
  someArray: z.array(
    z.object({
      value: z.boolean(),
    }),
  ),
})

This simple zod schema will report 2 errors that the type contains any. See: image Indeed the type definition from zod has "strip ZodTypeAny", but that means exactly that any isn't allowed.

Expected:

No error due to the zod schema being defined

Actual:

Errors whenever using zod, thus we resort to the annoying: image

If there would be a workaround it would be super cool

plantain-00 commented 5 months ago

it's any is in type arguments, you.can ignore them by --ignore-nested

molinch commented 5 months ago

Thanks so much for the prompt feedback @plantain-00 :)