setTypeId

View sourcesetTypeId(name: string): TypeId

Marks an explicit string as a TypeId for APIs that identify types by ID.

Use this to provide a type ID when the type has no runtime constructor, such as an enum or a union. The function does not validate, normalize, or look up name; it returns the same string with the TypeId annotation. The result can be supplied to an API that registers or looks up type metadata. Prefer typeid or typeidGeneric when a runtime constructor exists.

Because any string is accepted, this function can create an ID with no corresponding type metadata. Use the exact name expected by the consuming API.

Examples

const StatusId = setTypeId('Status')
// StatusId === 'Status'

Parameters

NameDescriptionDefault
name

The type ID to mark as a TypeId.

—

Returns

The unchanged name value.