Primary Overload
You can pass String, Boolean, or Number as the
primitiveType parameter.
The overloads to isPrimitive help you narrow
the type of a value. They also cause isPrimitive to
narrow to never if you pass a
JsonObject or JsonArray to it.
Overload
A JSON value.
Optional primitiveType: typeof String | typeof Boolean | typeof Number | nullA PrimitiveClass or undefined.
Narrows JsonObject and JsonArray to never. While
it probably doesn't make typically make sense to pass a value of a type
that's not a JsonObject or JsonArray, this overload
reflects the reality of the situation.
Overload
Narrows any JsonValue to a specific type of primitive based upon
the PrimitiveClass passed.
Specified type |
Narrowed Type |
|---|---|
String |
string |
Boolean |
boolean |
Number |
number |
null |
null |
Generated using TypeDoc
PRIMARY
Determine whether
valueis a primitive value.