assertIdType

See source code

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

NameDescription

id

string | undefined

The id to check.

type

RecordType<R, any>

The type of the record.

Returns

asserts id is IdOf<R>
Prev
useViewportHeight
Next
createComputedCache