Skip to content

Commit 89646da

Browse files
author
Kanchalai Tanglertsampan
committed
Manually Port #9156 and update baselines
1 parent a4f3083 commit 89646da

File tree

2 files changed

+17
-12
lines changed

2 files changed

+17
-12
lines changed

src/compiler/transformers/ts.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1623,6 +1623,11 @@ namespace ts {
16231623
if (isFunctionLike(node) && node.type) {
16241624
return serializeTypeNode(node.type);
16251625
}
1626+
else if (isAsyncFunctionLike(node)) {
1627+
// We still need to serialize return type of async function to be "Promise"
1628+
// even though there is no return type given by users.
1629+
return createIdentifier("Promise");
1630+
}
16261631

16271632
return createVoidZero();
16281633
}

tests/baselines/reference/decoratorMetadataPromise.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,20 +40,20 @@ class A {
4040
baz(n) { return n; }
4141
}
4242
__decorate([
43-
decorator,
44-
__metadata('design:type', Function),
45-
__metadata('design:paramtypes', []),
46-
__metadata('design:returntype', Promise)
43+
decorator,
44+
__metadata("design:type", Function),
45+
__metadata("design:paramtypes", []),
46+
__metadata("design:returntype", Promise)
4747
], A.prototype, "foo", null);
4848
__decorate([
49-
decorator,
50-
__metadata('design:type', Function),
51-
__metadata('design:paramtypes', []),
52-
__metadata('design:returntype', Promise)
49+
decorator,
50+
__metadata("design:type", Function),
51+
__metadata("design:paramtypes", []),
52+
__metadata("design:returntype", Promise)
5353
], A.prototype, "bar", null);
5454
__decorate([
55-
decorator,
56-
__metadata('design:type', Function),
57-
__metadata('design:paramtypes', [Promise]),
58-
__metadata('design:returntype', Promise)
55+
decorator,
56+
__metadata("design:type", Function),
57+
__metadata("design:paramtypes", [Promise]),
58+
__metadata("design:returntype", Promise)
5959
], A.prototype, "baz", null);

0 commit comments

Comments
 (0)