Skip to content

Instantly share code, notes, and snippets.

@nagolove
Created March 23, 2025 22:54
Show Gist options
  • Save nagolove/2c267c444536d9aa47c4acbace297a87 to your computer and use it in GitHub Desktop.
Save nagolove/2c267c444536d9aa47c4acbace297a87 to your computer and use it in GitHub Desktop.
-- somemod.d.tl | somemod.tl
local somemod = require "somemod"
local function myrequire(modname: string): <T>
local ok, err = pcall(function()
end)
local mod: any
if not ok then
-- try to instal throw luarocks --local
-- try to load with require
end
return mod
end
local somemod<T> = myrequire "somemod"
-- What type is T? How I can find it? Because of I had proper .tl file for module. But I could not write type-unsafe
-- require.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment