Comments (1)
This is supported with the following syntax:
-- foo.tl
local foo = {
IceCream = record
flavor: string
end
}
function foo.get_ice_cream(): foo.IceCream
return { flavor = "strawberry" }
end
return foo
and bar.tl
is unchanged as above:
-- bar.tl
local bar = {}
local foo = require("foo")
function bar.print_ice_cream(ic: foo.IceCream)
print("ice cream: " .. ic.flavor)
end
return bar
from tl.
Related Issues (20)
- No errors reported when assigning value directly to a record table
- Function does not enforce argument record type if variable type is inferred
- Type alias for nested generic crashes compiler HOT 1
- [next] `self` cannot be constrained by an interface HOT 1
- [next] interface methods
- Possible Typechecking Failure on Union Return HOT 2
- unexpected propagation of <const> attribute HOT 1
- missing narrowing type when not simple expression
- Inconsistencies between string escapes in Lua versions are not handled by Teal
- Feature request: Ability to rename the compiled files using regex HOT 2
- weird shadowing behavior regarding generic type names HOT 2
- reexport a nested table type HOT 1
- How do i solve this error? : argument 2: got type constant (alias), expected constant HOT 2
- flow-typing of return types at odds with polymorphic functions
- Support forward declarations, at least in a record HOT 3
- Nested record metatable issue? HOT 1
- [next] declaration of record methods does not work for aliased types HOT 2
- [next] union type does not specialize with and-or idiom
- [next] type alias definition gets confused with generics
- [next] Internal Compiler Error on `tl types` HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tl.