I'm looking for the implements keyword in combination with interface
#8901
|
I'm trying to wrap my head around interfaces. I'm aware of issue #481 which implies that TypeSpec interfaces were probably not designed to match common OOP terminology from the beginning. I understand that I can do import "@typespec/http";
using Http;
interface Foo {
one(): uint32;
two(@path foo: uint32): uint32;
}
@route("foo")
namespace Something {
op one is Foo.one;
op two is Foo.two;
}But I have to enumerate each operation individually in the route definitions at the bottom. I wonder if there is some way to include all operations of an interface inside the This is purely a theoretical exercise that only serves my learning process. I do not need this as a feature. |
Answered by
timotheeguerin
Nov 3, 2025
Replies: 1 comment
|
you can use import "@typespec/http";
using Http;
interface Foo {
one(): uint32;
two(@path foo: uint32): uint32;
}
@route("foo")
interface Something extends Foo {}
note that interface extends is more like spread |
0 replies
Answer selected by
jbethune
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
you can use
extendsplaygroundnote that interface extends is more like spread