Open ArcturusZhang opened 6 months ago
Narrow down could also happen with union types, such as:
model Foo {
p: string | int32;
}
model Bar extends Foo {
p: string;
}
or with literal unions
model Foo {
p: "a" | "b";
}
model Bar extends Foo {
p: "b";
}
Even this could compile as a tsp:
model Foo {
p: string;
}
model Bar extends Foo {
p?: string;
}
or vice versa
model Foo {
p?: string;
}
model Bar extends Foo {
p: string;
}
Describe the issue or request
For instance we could have this in tsp:
in which the model
Bar
extendsFoo
and narrows down the type of propertyp
inherited fromFoo
.We currently are not supporting this properly (the generator throws key already added exception).