isTypeObject
Determines if an object is a TypeObject.
type.isTypeObject(Type)
Given a Type, determines if it fits the TypeObject protocol. To be a TypeObject, a Type needs to be an object which contains the following symbols:
Symbol.for("can.new")
Symbol.for("can.isMember")
import { ObservableObject, type } from "can";
class Faves extends ObservableObject {}
console.log("An Typed Observable", type.isTypeObject(faves)); // true
console.log("A custom TypeObject", type.isTypeObject({
[Symbol.for("can.new")]() {},
[Symbol.for("can.isMember")]() {}
})); // -> true
console.log("A primitive", type.isTypeObject(null)); // -> false
Parameters
- Type
{*}
:Anything, but usually an object of some sort.