@Interface
decoratorAn interface as a CLASS. It is also a runtime value, so a manifest names it by
reference (requires: { db: [Db, RuntimeModule] }) instead of by string. Nothing is
ever constructed from it and nothing is checked by instanceof: the check is
structural (kernel/sig.ts); the class is only the handle. The generator projects the
instance type like any other interface.
The interface declares its own members — @Interface(), and the members are the
class's, which is where their doc comments belong:
@Interface()
export abstract class Db {
abstract prepare(sql: string): Opaque<"StatementSync", StatementSync>;
abstract close(): void;
}A decorated class must be exactly a declaration: no heritage, no constructor, no concrete or private member. The generator rejects the rest rather than deciding what belongs in the contract.
The optional key pins the interface-table key the host ships the class under — a
plugin-facing interface keeps its key while its declaration moves between packages,
so the manifests that require it by name keep resolving.
Declaration
export function Interface<T = unknown>(key?: string): IfaceHandle<T>Parameters & Return
key?
string@returns
IfaceHandle<T>