teal-language / tl

The compiler for Teal, a typed dialect of Lua
MIT License
2.02k stars 101 forks source link

Creating type that yields type A if indexed with integer, and type B if indexed with string #722

Open Frityet opened 7 months ago

Frityet commented 7 months ago

Something like

type MyType = { integer: A, string: B }
local my_tbl: MyType = {
    [1] = make_a(),
    key = make_b()
}

It would be really nice and useful