[as-variant](https://github.com/) allows you to have the possibility of mixing types and returning multiple types from a function. It allows a certain amount of dynamicness while maintaining strict typing.
Basic Usage
import { Variant } from 'as-variant'
class Foo { }
let vNum = Variant.from(123) // stored as i32
let vStr = Variant.from('hello') // stored as string
let vFoo = Variant.from(new Foo) // stored as Foo reference
vNum.set(2.0) // now stored as f64
assert(vNum.is<f64>()) // ok
assert(!vStr.is<f64>()) // ok
assert(vStr.is<string>()) // ok
assert(vFoo.is<Foo>()) // ok
let valF64 = vNum.get<f64>() // safely extract value
let willFail = vNum.get<string>() // will throw exception!
Unsafe Usage
let vNum = Variant.from(123)
// `getUnchecked` skips all checks. It may be danger.
assert(vNum.getUnchecked() == 123)