ResourceCtor type
A Resource class that's eligible to live in the registry.
- The construct signature uses
anyfor bothcontextandpropsbecause concrete classes narrow these (child resources require a specific parent class as context; each resource has its ownPropsshape). TypeScript's parameter contravariance would reject any concrete parameter types here. The deserializer is the sole caller of resolved constructors and forwards already-correct values it built from the wire document. - The two static fields
resourceTypeandapiVersionform the registry key and are always present on emitter-generated classes (and on the hand-maintainedResourceGroup). - The generic
Tpropagates the instance type — used by the query API (stack.getResources(KeyVault)→KeyVault[]) to narrow return types without needing a separate descriptor object.
type ResourceCtor<T> = (context: any, props: any, options?: any) => T