Skip to content

[V] getParentResource

getParentResource: StateMapGetter<Model, Model>;

Get the parent resource type for a given resource model.

The TypeSpec program instance

The resource model to get the parent for

The parent resource model if one exists, otherwise undefined

@parentResource(Organization)
model User {}
const parentType = getParentResource(program, userModel);
// parentType would be the Organization model