Parameter decorators in setter is a valid syntax ?
See original GitHub issueTypeScript 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:
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
The @property Decorator in Python: Its Use Cases ...
The syntax used to define properties is very concise and readable. You can access instance attributes exactly as if they were public attributes ......
Read more >How To Use Decorators in TypeScript - DigitalOcean
In TypeScript, you can create decorators using the special syntax ... is going to be called with the someBooleanFlag parameter set to true...
Read more >Primer on Python Decorators
Decorators provide a simple syntax for calling higher-order functions. ... For our purposes, a function returns a value based on the given arguments....
Read more >TypeScript decorators basics - Jannik Wempe
Each of the decorator functions receives different parameters. The accessor decorator is an exception, because it is essentially just a method ...
Read more >Documentation - Decorators - TypeScript
The expression for the class decorator will be called as a function at runtime, with the constructor of the decorated class as its...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Would have to ask @rbuckton
OK, whether it’s allowed or not. The implementation in TS is strange, it’s exactly a bug. IMHO, TS can disallow this syntax or fix this bug.