tslib __decorate was conflict with property decorator definition
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 25/100
- Issue type
- Bug
- Clarity
- Needs clarification
- Activity status
- Stale
- Tech stack
- typescript
- Domain
- tooling
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.
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?
- Dominant language
- TypeScript
- Stars
- 1.3k
- Forks
- 145
- PR merge metrics
- No merged PRs in 30d
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.
More from microsoft/tslib
-
question
Difficulty 4/5 3-5 days Newbie friendliness 38/100
-
Difficulty 1/5 Under an hour Newbie friendliness 15/100
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
copse-dev/agent-pane#2953 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Eynzof/Hermes-CN-Desktop#610 ·
-
bug clawsweeper:linked-pr-open clawsweeper:needs-live-repro clawsweeper:no-new-fix-pr impact:message-loss issue-rating: 🐚 platinum hermit P2 regression
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
calcite-components needs triage refactor
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Esri/calcite-design-system#15203 ·