tslib __decorate was conflict with property decorator definition
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 1.3k
- Forks
- 145
- PR merge metrics
- No merged PRs in 30d
Description
such a code with property decorator usage:
class Controller {
name = 'xx';
@inject(Store)
store: any = null;
}
after a tsc compiling:
var Controller = /** @class */ (function () {
function Controller() {
this.name = 'xx';
this.store = null;
}
tslib_1.__decorate([
inject_1.default(Store)
], Controller.prototype, "store", void 0);
return Controller;
}());
and here is the tslib __decorate implementation:
https://github.com/Microsoft/tslib/blob/b1ed5e1b940756d18609833caf9b781e9bc3984f/tslib.js#L85-L90
we can realize that if the property decorator return a descriptor, __decorate function will define property for us, from the code above.
but in typescript lib.es.d.ts definition, property decorator should not return anything:
https://github.com/Microsoft/TypeScript/blob/master/lib/lib.es6.d.ts#L1285
declare type PropertyDecorator = (target: Object, propertyKey: string | symbol) => void;
so which one is the truth?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Compare the __decorate implementation in tslib.js at the linked lines with the PropertyDecorator definition in TypeScript's lib/lib.es6.d.ts and the generated example in the issue. Determine whether the runtime behavior and type definition should agree, then document the expected behavior or identify the necessary change and its validation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100