- All types are checked at runtime
- Supported for ES5++ browsers.
- Object roots are freezed after thy are created.
- Initialized objects are prevented from extension.
- To define object you must provide two objects to Type.create(type_definition, prototype);
- _construct function is executed when object is constructed to inherit use _super(arguments) inside of _construct
- _invoke is executed before _construct cross inherited objects on each object construction
- _super() use _super(arguments) call to call inherited method.
- _super is not allowed to be executed inside _invoke call
- In IE 8,7,6 inheritance works but extensions and changes are allowed.
/// var Parent = Type.create([type definition], [prototype]);/// var Child = Parent.inherit([type definition], [prototype]);var AdminUser Group User;Group = Type;AdminUser = Group;User = AdminUser;var user = 'igor';userusername = 1; // throws type error because initial value is stringuserdate = ; // throw type error because initial value is dateuserdate = ; // is allowed because is correct typeuserdate = null; // its allowed because all members are allowed to be null or undefined because of GCuserdate = 1; // re assigning values with wrong type throws type erroruserdate = ; // re assigning initial value is allowedUserprototypeone = 1; // Will throw type error because adding something to prototype after initialization is not allowedUserone = 1; // Extending roots is not allowed