microsoft / microsoft/typespec

Support for `model Foo<T> extends/is T`

Open
#423 2 comments 1 reaction 1 assignee Claimed by @bterlson View on GitHub
design:needed
Dominant language
Java
Stars
5.9k
Forks
394
Avg merge
1d 23h
Merged PRs (30d)
104

Description

I would expect this to work, and allows for some useful patterns like:

```
@blue model AsBlue is T;
model Test {
blueString: AsBlue
}
```

This really drives home the need for errors which highlight on one place (e.g. an instantiation like AsBlue) but whose elaboration includes additional details (e.g. template uses T in an extends, but the thing you passed can't be a base model). Presumably such machinery would be useful elsewhere, e.g. when a particular interface mixes ends up violating some constraint inside the abstraction.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.