microsoft / microsoft/TypeScript

decorators in object literals not working

Open
#5,770 20 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Committed Domain: Decorators Suggestion
Dominant language
Go
Stars
111k
Forks
14.3k
Avg merge
2d 4h
Merged PRs (30d)
132

Description

From @pascalopitz on November 19, 2015 11:43

I am getting a parsing error for decorators on object literal properties. My jsconfig.json looks like this:

{
    "compilerOptions": {
        "target": "ES6",
        "module": "commonjs",
        "experimentalDecorators": true
    }
}

This code compiles okay in babel 5.8.12 using the "es7.decorators" extension.
Can I somehow make this work?

image

Copied from original issue: Microsoft/vscode#201

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the parsing error with the object-literal decorator example and the shown jsconfig.json settings, then compare the requested syntax with the compiler's existing experimental decorator support. Done means the example parses and compiles successfully with experimentalDecorators enabled, with behavior matching the intended decorator semantics.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.