Skip to content

Add compiler options to disable decorator transform #16882

Closed
@cncolder

Description

@cncolder

We missing an option to disable decorator transform. Code below preserveDecorators option is virtual.

TypeScript Version: 2.4.0

Code

tsconfig.json

{
  "compilerOptions": {
    "target": "es2017",
    "module": "es2015",
    "experimentalDecorators": true,
    "preserveDecorators": true
  }
}

index.ts

class Foo {
  @autobind
  onClick(e: Event) {
    console.log(e)
  }
}

Expected behavior:

index.js

class Foo {
  @autobind
  onClick(e) {
    console.log(e);
  }
}

Actual behavior:

index.js

class Foo {
  onClick(e) {
    console.log(e);
  }
}
__decorate([
    autobind
], Foo.prototype, "onClick", null);

Metadata

Metadata

Assignees

No one assigned

    Labels

    Working as IntendedThe behavior described is the intended behavior; this is not a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions