microsoft / microsoft/TypeScript
Parameter decorators in setter is a valid syntax ?
Open
Nobody has claimed this yet.
Bug
Domain: Decorators
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 132
Description
TypeScript Version: 4.0.5
Search Terms:
parameter decorators, setter
Code
class A {
set c(@log('c1') c1: string) {}
}
Expected behavior:
Throw error.
Actual behavior:
No errors now, and performs strange behaviours. Please check playground.
Related Issues:
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 TypeScript playground link and the supplied setter example using a parameter decorator. Trace how the compiler parses and validates decorators on setter parameters, then confirm that the example receives the expected diagnostic rather than compiling without errors.
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