microsoft / microsoft/TypeScript
Erronous documentation for property decorators?
オープン
@rbuckton がすでに取り組んでいます。
2017年1月4日 から。
Docs
- 主要言語
- Go
- スター
- 111k
- フォーク
- 14.3k
- 平均マージ
- 2日 4時間
- マージ済み PR(30日)
- 132
説明
At https://www.typescriptlang.org/docs/handbook/decorators.html
..it reads under "Property Decorators"
If the property decorator returns a value, it will be used as the Property Descriptor for the member.
NOTE The return value is ignored if your script target is less than ES5.
I'm running a simple example with target ES6
function MyPropDesc() {
return function (targetProto: Object, propName: string | symbol) {
return {
get: function() { console.log('in getter') }
}
}
}
class SomeClass {
@MyPropDesc()
someMember;
}
However, this doesn't seem to work. Also, when debugging this, my property decorator is being called from Reflect.js's DecoratePropertyWithoutDescriptor which ignores the result from the descriptor. And...typescript requires the decorator to return void or any. Documentation mistake?
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
評価
この issue はまだ評価されていません。