YousefED / typescript-json-schema

Generate json-schema from your Typescript sources
BSD 3-Clause "New" or "Revised" License
3.17k stars 323 forks source link

Union types may be considered as reffedTypes #482

Closed NPellet closed 2 years ago

NPellet commented 2 years ago

Subtypes of unions should be considered eligible for asTypeAliasRef in getTypeDefinition

e.g.

type A = {
  "prop": string
}

type B = {
  "prop": string,
  "refToA"?: A | null 
}

should return a reference to A when compiled with --aliasRefs

PS: Sorry for the changes introduced by prettier...

domoritz commented 2 years ago

Thank you. Please remove the npm lock file.

NPellet commented 2 years ago

Sorry, screwed up my last commit.

Coming up