isCustomRecordId

See source code

Type guard to check if a string is a valid ID for a specific custom record type.

function isCustomRecordId(typeName: string, id?: string): boolean;

Example

const id = "comment:abc123";
if (isCustomRecordId("comment", id)) {
  // id is now typed as a comment record ID
  const comment = store.get(id);
}

Parameters

NameDescription

typeName

string;

The type name to check against

id

string;

The string to check

Returns

boolean;

True if the string is a valid ID for the specified record type

Prev
isCustomRecord
Next
isDocument