Typings
Last updated
Was this helpful?
Last updated
Was this helpful?
ActiveJS is strictly typed, it does its best to infer and enforce as many typings as possible. However, where it can't infer a type, it uses generics so that you can pass a type.
For example, , , and accept a type for their value. doesn't need to be passed types, as it can infer the types from the provided members automatically.
, , and don't accept a type because it's already implied as boolean
, number
, and string
, respectively.
's value already has an array
type, but it can't know about the type of items that the array is going to contain. You can pass it at the time of instantiation.
's value already has an object
literal type, but it doesn't know the type of key-value pairs it's going to hold. You can pass it at the time of instantiation.
's value has an any
type, it allows all types of values and leaves the typings to the developer. You can pass it at the time of instantiation.
doesn't have a value of its own, it derives value from its member Units, 3 of them are GenericUnits and 1 is BoolUnit. The three GenericUnits can be supplied types through AsyncSystem's generics.
doesn't need to be passed types explicitly, since it doesn't create Units itself, they are provided externally, and it can infer the types from the provided Units.
has any
as its default value type, it can be restricted by passing a specific type through generics.