Skip to main content

Function: getModelTypeAndId()

function getModelTypeAndId(model): ModelTypeAndId | undefined;

Gets the model type and ID from a Model or DataModel instance.

The result includes:

  • modelType: The model type name (from $modelType)
  • modelId: The model ID value (or undefined if no ID property)
  • modelIdPropertyName: The name of the property that holds the model ID (or undefined if no ID property)
  • modelInfo: The model info (contains the model class and name)

Parameters​

ParameterTypeDescription
model| AnyDataModel | AnyModelA Model or DataModel instance.

Returns​

ModelTypeAndId | undefined

The model type and ID info, or undefined if not a valid model.