Skip to content

type: null generated as "any object" record #667

@fastcat

Description

@fastcat

Schema:

$schema: "https://json-schema.org/draft/2020-12/schema"
type: object
additionalProperties: false
required: [nullProp]
properties:
    nullProp:
        type: null

Generate with: npx --package=json-schema-to-typescript@^15 json2ts -i schema.yaml -o schema.ts
Produces (minus headers):

export interface Schema {
  nullProp: {
    [k: string]: unknown;
  };
}

Expected:

export interface Schema {
  nullProp: null;
}

Workaround: use tsType

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions