-
Couldn't load subscription status.
- Fork 318
Description
Problem
While doing this PR #8751 to fix some cases where we wrongly didn't instantiate types this uncovered a pattern that was kinda allowed before(though failing if you actually used it)
If an templated interface operation reference another operation in that interface then it would actually reference the interface declaration not the same instance. It somwhow kinda works when the parmaeter wasn't used but would get a crash as it would keep some TemplateParameter type in the type graph
interface Base<A> {
Default is Base.Custom<A>;
Custom<T>(a: A): T;
}
interface Test extends Base<string> {}Proposal
Introduce a self or this that reference to the current instance, the above could be rewritten as
interface Base<A> {
Default is self.Custom<A>;
Custom<T>(a: A): T;
}Things to figure out what does it means with spread or inheritance like
model Base {
id: string;
extId: self.id;
}
model Case1 extends Base {
id: uuid;
}
model Case2 {
...Pick<Base, "extId">
id: uuid;
}is extId string or uuid here