-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Closed
Labels
DuplicateAn existing issue was already createdAn existing issue was already created
Description
TypeScript Version: 2.1.1 / nightly (2.2.0-dev.201xxxxx)
All Typescript Versions
Code
class Post {
tags: string[];
}
Expected behavior:
There should be metadata added to indicate the type of array.
class Post {
constructor() {}
}
__decorate([
__metadata('design:type', [String])
], Post.prototype, "tags", void 0);
Actual behavior:
class Post {
constructor() {}
}
__decorate([
__metadata('design:type', Array)
], Post.prototype, "tags", void 0);
If you look at how rest parameters are handled, there is precedent for preserving array type:
Given:
class Post {
tags: string[];
constructor(...tags:string[]) {}
}
The output is:
class Post {
constructor() {}
}
__decorate([
__metadata('design:type', Array)
], Post.prototype, "tags", void 0);
Post = __decorate([
__metadata('design:paramtypes', [String])
], Post);
Metadata
Metadata
Assignees
Labels
DuplicateAn existing issue was already createdAn existing issue was already created