assertIdType
Assert whether an id correspond to a record type.
function assertIdType<R extends UnknownRecord>(
id: string | undefined,
type: RecordType<R, any>
): asserts id is IdOf<R>
Example
assertIdType(myId, 'shape')
Parameters
Name | Description |
---|---|
|
The id to check. |
|
The type of the record. |
Returns
asserts id is IdOf<R>