Decorator syntax
See original GitHub issueWhat is the Civet syntax for TS decorators?
Given:
const printable = (target: any, memberName: string) =>
console.log memberName
class Person
@printable
name = 'Jon'
I get the warning Member 'printMemberName' implicitly has an 'any' type.typescript(7008)
because @
is used for static members.
The Code Sample at the top of the readme contains the
experimentalDecorators: true
flag in the compiler options, so I assume they are supported.
Issue Analytics
- State:
- Created 10 months ago
- Comments:6 (5 by maintainers)
Top Results From Across the Web
Primer on Python Decorators
Decorators provide a simple syntax for calling higher-order functions. By definition, a decorator is a function that takes another function and extends the ......
Read more >Decorators in Python - GeeksforGeeks
In Decorators, functions are taken as the argument into another function and then called inside the wrapper function. Syntax for Decorator:.
Read more >PEP 318 – Decorators for Functions and Methods
This document is meant to describe the decorator syntax and the process ... The current syntax for function decorators as implemented in Python...
Read more >Python Decorators (With Examples) - Programiz
In Python, a decorator is a design pattern that allows you to modify the functionality of a function by wrapping it in another...
Read more >Documentation - Decorators - TypeScript
TypeScript Decorators overview. ... Decorators provide a way to add both annotations and a meta-programming syntax for class declarations and members.
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 Free
Top 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
I’ve added support for decorators with
@@
syntax instead of@
because@
is premium real estate and@id
->this.id
, and@
is also static fields/methods, etc.If
@
decorator syntax makes it to a standard then maybe I’ll re-evaluate but I’d rather pressure the spec in this direction.Ideally we could become so popular that the decorator proposal changes before it becomes a standard 😼