microsoft / microsoft/TypeScript
In JSDocs notation for index signatures, Object and object should be treated as the same
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 132
Description
TypeScript Version: 2.7.0-dev.201xxxxx
Code
/**
* Test.
*
* @param {object.<string, number>} obj An object.
*/
function func(obj) {
console.log(obj);
}
Expected behavior:
obj should have a index signature as in #15105
Actual behavior:
obj is treated as any
Additional Info:
This was mentioned in the above issue, and it seems to be related to the way Typescript manage Object and object, but in JSDocs, they are treated similar.
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 by reproducing the provided JSDoc example with the TypeScript version under investigation and compare it with the behavior described in issue #15105. Trace how the JSDoc index-signature annotation is interpreted, then verify that object.<string, number> gives obj an index signature instead of any.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100