kailua_check 1.1.0

Type checker for Kailua
Documentation
-- definitions for Lua 5.1 io library

--# type local file = {
--#     -- TODO method receivers and recursive types are generally not implemented yet
--#     `close`: function(self: WHATEVER);
--#     `flush`: function(self: WHATEVER);
--#     `lines`: function(self: WHATEVER) --> function() --> string?;
--#     -- TODO should be: function(self, '*n') --> number &
--#     --                 function(self, '*a') --> string &
--#     --                 function(self, '*l'|integer?) --> string
--#     -- for now, let's ignore *n (which is most useless)
--#     `read`: function(self: WHATEVER, format: '*a'|'*l'|integer?) --> string;
--#     `seek`: function(self: WHATEVER, whence: 'set'|'cur'|'end'?, offset: integer?);
--#     -- TODO again, 'no' does not accept an integer
--#     `setvbuf`: function(self: WHATEVER, mode: 'no'|'full'|'line', size: integer?);
--#     `write`: function(self: WHATEVER, string|number...);
--# }
--#
--# assume global `io`:
--#     {
--#         `close`: function(file: file?);
--#         `flush`: function();
--#         -- TODO should be separated
--#         `input`: function(file: string|file?) --> file;
--#         `lines`: function(filename: string?) --> function() --> string?;
--#         -- TODO sequence conditional union: (file) | (nil, string)
--#         `open`: function(filename: string, mode: string?) --> (file, string);
--#         `output`: function(file: string|file?) --> file;
--#         `popen`: function(prog: string, mode: string?) --> file;
--#         `read`: function(format: '*a'|'*l'|integer?) --> string;
--#         `tmpfile`: function() --> file;
--#         `type`: function(obj: any) --> 'file'|'closed file';
--#         `write`: function(string|number...);
--#         ...
--#     }