LuaLS / LuaLS/lua-language-server
Request/How-to: Get return type of generic function
Nobody has claimed this yet.
- Dominant language
- Lua
- Stars
- 4.4k
- Forks
- 442
- PR merge metrics
- No merged PRs in 30d
Description
I have a function which accepts a generic function as its parameter. It does stuff with that function, then returns that function's return value(s) as its own. I would like for the returned properties to cascade from the generic function and propogate accordingly for type information.
In TypeScript, I would do:
const foo = <T extends Function>(func: T): ReturnType<T> => func(...)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No files, tests, or entry points are named. Start by locating how generic functions and their return types are represented in the language server, using the TypeScript ReturnType example as the requested behavior; done means returned properties propagate from the passed generic function.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- lua
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100