Skip to content

Use with fluent-json-schema now requires to call valueOf in ObjectSchema when using Typescript #138

@Ceres6

Description

@Ceres6

Prerequisites

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

Last working version

5.1.0

Stopped working in version

5.1.1

Node.js version

18.x

Operating system

macOS

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

12.3

💥 Regression Report

Typings in Typescript now throw an error when using a fluent-json-schema generated schema as input for envSchema

Steps to Reproduce

In a Typescript file the next block of code reproduces the issue

import envSchema from 'env-schema'
import S from 'fluent-json-schema'

envSchema({
  schema: S.object()
})
Type 'ObjectSchema' is not assignable to type 'AnySchema | UncheckedJSONSchemaType<EnvSchemaData, false> | undefined'.
  Type 'ObjectSchema' is not assignable to type '{ type: "object"; additionalProperties?: boolean | UncheckedJSONSchemaType<unknown, false> | undefined; unevaluatedProperties?: boolean | UncheckedJSONSchemaType<unknown, false> | undefined; ... 7 more ...; maxProperties?: number | undefined; } & { ...; } & { ...; } & { ...; }'.
    Property 'type' is missing in type 'ObjectSchema' but required in type '{ type: "object"; additionalProperties?: boolean | UncheckedJSONSchemaType<unknown, false> | undefined; unevaluatedProperties?: boolean | UncheckedJSONSchemaType<unknown, false> | undefined; ... 7 more ...; maxProperties?: number | undefined; }'.ts(2322)

Nevertheless the following block of code does not throw an error

import envSchema from 'env-schema'
import S from 'fluent-json-schema'

envSchema({
  schema: S.object().valueOf
})

Expected Behavior

As ObjectSchema from fluent-json-schema was removed from typings in #137 it might be solved otherwise or maybe be documented to avoid future confusion

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions