microsoft / microsoft/TypeScript
Parameters typed as `unknown` even when the function type has the correct types
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 117
Description
🔎 Search Terms
mapped types, function types
🕗 Version & Regression Information
- This is the behavior that starts in version 4.9, and I reviewed the FAQ for entries about function types
All the versions prior to 4.9 have both scenarios with the params typed tounknown
⏯ Playground Link
💻 Code
No response
🙁 Actual behavior
The function with no default shows the proper function type but the parameters are typed as unknown
🙂 Expected behavior
The parameters should have the types of the function params
Additional information about the issue
There is also a smaller reproduction that was made by mkantor on discord.
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
Start with the two linked TypeScript Playground reproductions and compare the parameter inference behavior across the reported versions. Trace the mapped-type and function-type inference involved, then confirm that parameters receive the function's declared types rather than unknown in both scenarios.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100