-
Notifications
You must be signed in to change notification settings - Fork 189
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incorrect output for Generic with UnionType #3
Comments
It works for me export interface LogicalOperand<T> {
foo: T;
}
export type Condition<T> = {
selection: LogicalOperand<string>;
} & T;
export interface MyObject {
bar: number;
}
export type MyType = Condition<MyObject>; {
"$ref": "#/definitions/MyType",
"$schema": "http://json-schema.org/draft-04/schema#",
"definitions": {
"Condition<MyObject>": {
"additionalProperties": false,
"properties": {
"bar": {
"type": "number"
},
"selection": {
"$ref": "#/definitions/LogicalOperand<string>"
}
},
"required": [
"bar",
"selection"
],
"type": "object"
},
"LogicalOperand<string>": {
"additionalProperties": false,
"properties": {
"foo": {
"type": "string"
}
},
"required": [
"foo"
],
"type": "object"
},
"MyObject": {
"additionalProperties": false,
"properties": {
"bar": {
"type": "number"
}
},
"required": [
"bar"
],
"type": "object"
},
"MyType": {
"$ref": "#/definitions/Condition<MyObject>"
}
}
} |
This doesn't have a union type inside Try |
export type Condition<T> = {
selection: T;
};
export interface A {
foo: number;
bar: number;
}
export interface B {
bar: number;
baz: number;
}
export type MyType = Condition<A | B>; {
"$ref": "#/definitions/MyType",
"$schema": "http://json-schema.org/draft-04/schema#",
"definitions": {
"A": {
"additionalProperties": false,
"properties": {
"bar": {
"type": "number"
},
"foo": {
"type": "number"
}
},
"required": [
"foo",
"bar"
],
"type": "object"
},
"B": {
"additionalProperties": false,
"properties": {
"bar": {
"type": "number"
},
"baz": {
"type": "number"
}
},
"required": [
"bar",
"baz"
],
"type": "object"
},
"Condition<(A|B)>": {
"additionalProperties": false,
"properties": {
"selection": {
"anyOf": [
{
"$ref": "#/definitions/A"
},
{
"$ref": "#/definitions/B"
}
]
}
},
"required": [
"selection"
],
"type": "object"
},
"MyType": {
"$ref": "#/definitions/Condition<(A|B)>"
}
}
} |
See last comment. This works now. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Condition<FieldDef|ValueDef>
only has propertyselection
but no properties fromFieldDef
andValueDef
.See vega/vega-lite@06cc8dc in vega/vega-lite#1980.
Note that this is no longer a blocking issue since I redeclare this using
Condition<FieldDef> | Condition<ValueDef>
which is a better declaration anyway.(I'm just filing the bug here so we are aware of this bug.)
The text was updated successfully, but these errors were encountered: