18 lines
656 B
TypeScript
18 lines
656 B
TypeScript
import type { InterfaceRevision } from "../capability-model/types.js";
|
|||
|
|
|
||
|
|
/** Public, checked type information for artifact consumers. It describes the
|
||
|
|
* nominal role, without exposing implementations or synthesizing any storage. */
|
||
|
|
export function moduleTypeContext(iface: InterfaceRevision): {
|
||
|
|
typeArguments?: readonly unknown[];
|
||
|
|
requiredInterfaces?: readonly string[];
|
||
|
|
} {
|
||
|
|
return {
|
||
|
|
...(iface.application?.arguments.length
|
||
|
|
? {
|
||
|
|
typeArguments: structuredClone(iface.application.arguments),
|
||
|
|
}
|
||
|
|
: {}),
|
||
|
|
...(iface.requiredInterfaces?.length ? { requiredInterfaces: [...iface.requiredInterfaces].sort() } : {}),
|
||
|
|
};
|
||
|
|
}
|