ts-json-schema-generator
ts-json-schema-generator copied to clipboard
Invalid index error with indexed access of optional member of generic parameter constraint
Given the example:
export interface MyGeneric<T extends { a?: string; b: number }> {
a: T["a"];
b: T["b"];
}
export interface MyObject extends MyGeneric<{ b: number }> {}
The following output is expected:
{
"$ref": "#/definitions/MyObject",
"$schema": "http://json-schema.org/draft-07/schema#",
"definitions": {
"MyObject": {
"additionalProperties": false,
"properties": {
"b": {
"type": "number"
}
},
"required": [
"b"
],
"type": "object"
}
}
}
However, the generator throws the following error:
Invalid index "a" in type "structure-896447058-143-156-896447058-132-157-896447058-124-157-896447058-97-160-896447058-0-161"
I've added a test that reproduces this behavior here: https://github.com/vega/ts-json-schema-generator/commit/5773d322a13bf98fe2196edd374b6b408edd33b1
Any progress on this issue ?