microsoft / microsoft/TypeScript
`default` keyword is offered in expression-bodied arrow function completions
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 132
Description
Bug Report
Search Terms
- arrow function completion
- default keyword completion
- expression-bodied arrow function
- keyword completions
- completionListAtEndOfWordInArrowFunction
Version & Regression Information
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about keyword completions in expression-bodied arrow function contexts.
Playground Link
Playground link with relevant code: https://www.typescriptlang.org/play?#code/PTAEFkE9QYwewCYFNQHM5IM6gBZIE5JA
Code
(d, defaultIsAnInvalidParameterName) => d
(d, defaultIsAnInvalidParameterName) => default
Actual behavior
At the expression-bodied arrow function completion position, default is offered as a keyword completion.
Expected behavior
default should not appear as a keyword completion in expression-bodied arrow function expression context.
Additional information about the issue
There are already nearby fourslash tests that appear to acknowledge this behavior as undesirable:
tests/cases/fourslash/completionListAtEndOfWordInArrowFunction02.tstests/cases/fourslash/completionListAtEndOfWordInArrowFunction03.ts
I also traced the completion path locally and confirmed the keyword currently comes from the generic FunctionLikeBodyKeywords filtering path.
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 completion path described in the issue and the generic FunctionLikeBodyKeywords filtering path. Read tests/cases/fourslash/completionListAtEndOfWordInArrowFunction02.ts and tests/cases/fourslash/completionListAtEndOfWordInArrowFunction03.ts, then use the linked Playground example to reproduce the completion. Done means default is absent in expression-bodied arrow function expression completions and the relevant fourslash coverage passes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 68/100