πͺStrongType
strongType
Create strong typed variables without TypeScript!
Examples
Use
Class
First, require the StrongType
class using the namespace strongType
Then assign a variable to a new StrongType
you can change / access the variable using .v
StrongType(
value?*
, Type?*, allowUndefined?);
- Argument: The value of the variable, not required if there is a Type.
StrongType(value?*,
Type?*
, allowUndefined?);
- Argument: The type of the variable, defaults to the type of the value if not defined.
StrongType(value?*, Type?*,
allowUndefined?
);
- Argument: If the variable can be set to undefined, this argument is optional.
Global
First, require the defineStrongType
function using the namespace strongType
Then run the function to create a global typed variable
This variable is global, and can be accessed / changed anywhere with just the namespace
defineStrongType(
name
, value?*, Type?*, allowUndefined?);
- Argument: The name of the StrongType variable
defineStrongType(name,
value?*
, Type?*, allowUndefined?);
- Argument: The value of the variable, not required if there is a Type.
defineStrongType(name, value?*,
Type?*
, allowUndefined?);
- Argument: The type of the variable, defaults to the type of the value if not defined.
defineStrongType(name, value?*, Type?*,
allowUndefined?
);
- Argument: If the variable can be set to undefined, this argument is optional.
Last updated