ts-json-schema-generator icon indicating copy to clipboard operation
ts-json-schema-generator copied to clipboard

Incorrect schema generation for `NonNullable` of union type

Open loucadufault opened this issue 4 months ago • 4 comments

Seems like a very simple repro:

Simpler repro:

export type SomeType = {
  foo: NonNullable<'a' | 'b'>
}
{
  "$ref": "#/definitions/RelaxedMatchedHeadline",
  "$schema": "http://json-schema.org/draft-07/schema#",
  "definitions": {
    "RelaxedMatchedHeadline": {
      "properties": {
        "foo": {
          "anyOf": [
            {
              "properties": {},
              "type": "object"
            },
            {
              "properties": {},
              "type": "object"
            }
          ]
        }
      },
      "type": "object"
    }
  }
}

on @2.4.0

loucadufault avatar Jun 20 '25 21:06 loucadufault