Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ignore abstract methods when decorating class (#11345)
* Ignore abstract methods when decorating class * Address Nico's feedback * Add input/output test * Update test output to account for _nonIterableRest changes
- Loading branch information
1 parent
6a00cbe
commit 71e7a7b
Showing
5 changed files
with
133 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
...-features-plugin/test/fixtures/plugin-proposal-decorators/ignore-abstract-methods/exec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
function decorate(value: boolean) { | ||
return function( | ||
target: any, | ||
propertyKey: string, | ||
descriptor: PropertyDescriptor | ||
) {}; | ||
} | ||
|
||
abstract class A { | ||
@decorate(false) | ||
private decoratedMember: boolean; | ||
|
||
abstract myMethod(): number; | ||
} | ||
|
||
class B extends A { | ||
constructor() { | ||
super(); | ||
} | ||
|
||
myMethod(): number { | ||
return 5; | ||
} | ||
} | ||
|
||
const b = new B(); | ||
expect(b.myMethod()).toBe(5); |
26 changes: 26 additions & 0 deletions
26
...features-plugin/test/fixtures/plugin-proposal-decorators/ignore-abstract-methods/input.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
function decorate(value: boolean) { | ||
return function( | ||
target: any, | ||
propertyKey: string, | ||
descriptor: PropertyDescriptor | ||
) {}; | ||
} | ||
|
||
abstract class A { | ||
@decorate(false) | ||
private decoratedMember: boolean; | ||
|
||
abstract myMethod(): void; | ||
} | ||
|
||
class B extends A { | ||
constructor() { | ||
super(); | ||
} | ||
|
||
myMethod(): void { | ||
|
||
} | ||
} | ||
|
||
const b = new B(); |
9 changes: 9 additions & 0 deletions
9
...ures-plugin/test/fixtures/plugin-proposal-decorators/ignore-abstract-methods/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"presets": [ | ||
["typescript"] | ||
], | ||
"plugins": [ | ||
["proposal-decorators", { "decoratorsBeforeExport": true }], | ||
["proposal-class-properties"] | ||
] | ||
} |
67 changes: 67 additions & 0 deletions
67
...eatures-plugin/test/fixtures/plugin-proposal-decorators/ignore-abstract-methods/output.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.