Profectus / features/feature / isType
Function: isType() ​
isType<
T
>(object
,type
):object is { type: T }
Utility function for narrowing something that may or may not be a specified type of feature. Works off the principle that all features have a unique symbol to identify themselves with.
Type Parameters ​
• T extends symbol
Parameters ​
object ​
unknown
The object to determine whether or not is of the specified type
type ​
T
The symbol to look for in the object's "type" property
Returns ​
object is { type: T }
Whether or not the object is the specified type