I tried moving some things to an allOf setup, which works kinda 1,
but the primitive types are suddenly getting aliased.
e.g.
export type ShapeLocationMoveTarget = PositionTuple & {
location: Location;
floor: Floor;
};
export type Location = number;
export type Floor = string;
export interface PositionTuple {
x: number;
y: number;
}
For a small setup like this, it's not the worst thing in the world,
but for my real types it's generating hundreds of "useless" types that just bloat the output file.
The above ts output is part of this schema:
{
"title": "_Master_",
"type": "object",
"properties": {
"PositionTuple": {
"$ref": "#/definitions/PositionTuple"
},
"ShapeLocationMoveTarget": {
"$ref": "#/definitions/ShapeLocationMoveTarget"
}
},
"required": [
"PositionTuple",
"ShapeLocationMoveTarget"
],
"additionalProperties": false,
"definitions": {
"PositionTuple": {
"title": "PositionTuple",
"type": "object",
"properties": {
"x": {
"type": "integer"
},
"y": {
"type": "integer"
}
},
"required": [
"x",
"y"
],
"additionalProperties": false
},
"ShapeLocationMoveTarget": {
"title": "ShapeLocationMoveTarget",
"allOf": [
{
"$ref": "#/definitions/PositionTuple"
},
{
"type": "object",
"properties": {
"location": {
"title": "Location",
"type": "integer"
},
"floor": {
"title": "Floor",
"type": "string"
}
},
"required": [
"location",
"floor"
],
"additionalProperties": false
}
]
}
}
}
I tried moving some things to an
allOfsetup, which works kinda 1,but the primitive types are suddenly getting aliased.
e.g.
For a small setup like this, it's not the worst thing in the world,
but for my real types it's generating hundreds of "useless" types that just bloat the output file.
The above ts output is part of this schema:
Footnotes
It's using
typeand&instead ofinterfaceandextendsbut I can live with that ↩