teal-language / teal-types Goto Github PK
View Code? Open in Web Editor NEWTeal type definitions of Lua libraries!
License: MIT License
Teal type definitions of Lua libraries!
License: MIT License
My folder structure looks like this:
.
├── dist
│ └── ...
├── lua_modules
│ ├── lib
│ └── share
├── src
│ ├── init.tl
│ ├── inspect.d.tl
├── tlconfig.lua
lua_modules
has been populated by luarocks install <package> --tree lua_modules
with, eg, inspect
.
In this case, should I just copy the contents of inspect.d.tl
from this repo into src/inspect.d.tl
?
Penlight is a "batteries"-type module for Lua, and I feel like teal would greatly benefit from integrating properly with it.
I will start my fork along with this issue, I just wanted to create this for documentation's sake.
I'm trying to generate types for neovim, I cloned the repo, copied the files from types/neovim/*
to the root directory and ran ./autogen
, tho I'm getting the error
Error: could not predefine module 'types'
It's caused by the first command: tl check autogen_tl -q
Considering that some changes such as teal-language/tl#159 may break a few things in the declaration files, it would be a good idea to setup CI for this repo.
I am running into an issue where the folder structure of a shared typing library must also match the folder structure of the luarock paths. Ideally the types could be inferred from the luarock e.g. @types/kong
, but not sure how to have tl
know how to reconcile the defintion files.
├── kong
│ ├── db
│ │ ├── schema
│ │ │ └── typedefs.d.tl <----- would be nice to avoid creating the file structure since plugins (as you know @hishamhm :P) are placed within the larger context of kong with its own rockspec tree
│ │ └── schema.d.tl
│ └── plugins
│ └── myplugin
│ ├── handler.tl
│ └── schema.tl
├── kong-plugin-myplugin-0.1.0-1.rockspec
├── tlconfig.lua
└── types <----------- in the future would be nice to pull from teal-types luarocks similar to @types/<package> in typescript
├── kong
│ ├── db
│ │ ├── schema
│ │ │ └── typedefs.d.tl
│ │ └── schema.d.tl
│ └── plugins
│ └── session.d.tl
├── kong.d.tl
├── kong.lua
├── resty
│ └── session.d.tl
└── resty.tl
local typedefs = require "kong.db.schema.typedefs"
local schema = {
name = plugin_name,
fields = {
{ consumer = typedefs.no_consumer }, -- typedefs is only known because of the explicit folder structure
return {
gen_target = "5.1",
-- Execute the equivalent of `require('modulename')` before executing the script.
preload_modules = {
"types.resty",
"types.kong"
}
}
I am working on a .d.tl file for Neovim's Lua api, but since Neovim itself runs the code, there is no require("vim")
. Putting preload_modules = {"vim"}
causes a
Error: could not preload module 'vim'
In addition, frameworks like busted would have the same issues
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.