fastify/env-schema

`customOptions` is not typed, so TypeScript is giving errors

dietergeerts opened this issue · 2 comments

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure the bug has not already been reported

Fastify version

N/A

Plugin version

"env-schema": "^3.5",

Node.js version

14

Operating system

Windows

Operating system version (i.e. 20.04, 11.3, 10)

N/A

Description

Following error when using customOptions:

TS2322: Type '{ customOptions(ajvInstance: any): any; }' is not assignable to type 'Ajv'.   Object literal may only specify known properties, and 'customOptions' does not exist in type 'Ajv'

Because it's not in the types.

Steps to Reproduce

Just use customOptions in a TS file

Expected Behavior

Typings know about this extra feature, so there are no TS errors

Eomm commented

Would you like to send a Pull Request to address this issue? Remember to add unit tests.

@Eomm , I can take a look yes, but I never have written unit tests that specifically are testing types, but I assume I will find some in here to compare how to do that.