microsoft / microsoft/TypeScript
URLSearchParams/Headers constructor also receives iterables including Map
Open
Nobody has claimed this yet.
Domain: lib.d.ts
Experience Enhancement
Help Wanted
Suggestion
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 132
Description
TypeScript Version: master
Code
new Headers(new Map([['abc', 'bcd']])).get('abc')
new Headers({ [Symbol.iterator]() { return new Map([['abc', 'bcd']]).entries() } }).get('abc')
Expected behavior: Both returns bcd so should pass without errors
Actual behavior: 'not assignable' error
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 locating the standard library declarations for Headers and URLSearchParams and checking how their constructor inputs are typed. Compare those declarations with the iterable and Map examples in the issue, then run the relevant compiler or declaration tests; done means both examples type-check without errors and preserve the expected value.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100