Skip to content

Unable to use with Typescript without @json-schema-tools/meta-schema also being installed #821

@gpoole

Description

@gpoole

Describe the bug
Typescript users get type errors trying to use traverse due to JSONSchema not being available, since @json-schema-tools/meta-schema is only a devDependency of this package and the JSONSchema type doesn't seem to get bundled.

To Reproduce
Steps to reproduce the behavior:

  1. Install @json-schema-tools/traverse
  2. Attempt to write some trivial typescript transformer code such as:
    traverse(schema, (schemaOrSubschema) => {
       return schemaOrSubschema;
    });
  3. A type error is shown against the return type

Installing @json-schema-tools/meta-schema fixes the issue as the JSONSchema type is provided by it.

Expected behavior
I think this package should declare @json-schema-tools/meta-schema as either a peer dependency or regular dependency.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions