question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

What 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:closed
  • Created 10 months ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
STRd6commented, Dec 10, 2022

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.

1reaction
STRd6commented, Dec 9, 2022

Ideally we could become so popular that the decorator proposal changes before it becomes a standard 😼

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found