Skip to content

[Transforms] Update baselines and fix failure when merged with master #9168

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/compiler/transformers/ts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1575,10 +1575,10 @@ namespace ts {
* @param node The type node.
*/
function getRestParameterElementType(node: TypeNode) {
if (node.kind === SyntaxKind.ArrayType) {
if (node && node.kind === SyntaxKind.ArrayType) {
return (<ArrayTypeNode>node).elementType;
}
else if (node.kind === SyntaxKind.TypeReference) {
else if (node && node.kind === SyntaxKind.TypeReference) {
return singleOrUndefined((<TypeReferenceNode>node).typeArguments);
}
else {
Expand Down Expand Up @@ -1623,6 +1623,9 @@ namespace ts {
if (isFunctionLike(node) && node.type) {
return serializeTypeNode(node.type);
}
else if (isAsyncFunctionLike(node)) {
return createIdentifier("Promise");
}

return createVoidZero();
}
Expand Down
24 changes: 12 additions & 12 deletions tests/baselines/reference/decoratorMetadataPromise.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,20 @@ class A {
baz(n) { return n; }
}
__decorate([
decorator,
__metadata('design:type', Function),
__metadata('design:paramtypes', []),
__metadata('design:returntype', Promise)
decorator,
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", Promise)
], A.prototype, "foo", null);
__decorate([
decorator,
__metadata('design:type', Function),
__metadata('design:paramtypes', []),
__metadata('design:returntype', Promise)
decorator,
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", Promise)
], A.prototype, "bar", null);
__decorate([
decorator,
__metadata('design:type', Function),
__metadata('design:paramtypes', [Promise]),
__metadata('design:returntype', Promise)
decorator,
__metadata("design:type", Function),
__metadata("design:paramtypes", [Promise]),
__metadata("design:returntype", Promise)
], A.prototype, "baz", null);
40 changes: 20 additions & 20 deletions tests/baselines/reference/emitDecoratorMetadata_restArgs.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,18 @@ var A = (function () {
args[_i - 0] = arguments[_i];
}
};
__decorate([
MyMethodDecorator,
__metadata('design:type', Function),
__metadata('design:paramtypes', [Object]),
__metadata('design:returntype', void 0)
], A.prototype, "method", null);
A = __decorate([
MyClassDecorator,
__metadata('design:paramtypes', [Object])
], A);
return A;
}());
__decorate([
MyMethodDecorator,
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object]),
__metadata("design:returntype", void 0)
], A.prototype, "method", null);
A = __decorate([
MyClassDecorator,
__metadata("design:paramtypes", [Object])
], A);
var B = (function () {
function B() {
var args = [];
Expand All @@ -66,15 +66,15 @@ var B = (function () {
args[_i - 0] = arguments[_i];
}
};
__decorate([
MyMethodDecorator,
__metadata('design:type', Function),
__metadata('design:paramtypes', [String]),
__metadata('design:returntype', void 0)
], B.prototype, "method", null);
B = __decorate([
MyClassDecorator,
__metadata('design:paramtypes', [Number])
], B);
return B;
}());
__decorate([
MyMethodDecorator,
__metadata("design:type", Function),
__metadata("design:paramtypes", [String]),
__metadata("design:returntype", void 0)
], B.prototype, "method", null);
B = __decorate([
MyClassDecorator,
__metadata("design:paramtypes", [Number])
], B);
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"======== Resolving module './mod1' from '/mod2.ts'. ========",
"Module resolution kind is not specified, using 'Classic'.",
"File '/mod1.ts' exist - use it as a name resolution result.",
"Resolving real path for '/mod1.ts', result '/mod1.ts'",
"======== Module name './mod1' was successfully resolved to '/mod1.ts'. ========",
"======== Resolving type reference directive 'lib', containing file '/__inferred type names__.ts', root directory '/types'. ========",
"Resolving with primary search path '/types'",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@
"======== Resolving module './main' from '/mod2.ts'. ========",
"Module resolution kind is not specified, using 'Classic'.",
"File '/main.ts' exist - use it as a name resolution result.",
"Resolving real path for '/main.ts', result '/main.ts'",
"======== Module name './main' was successfully resolved to '/main.ts'. ========",
"======== Resolving module './mod1' from '/mod2.ts'. ========",
"Module resolution kind is not specified, using 'Classic'.",
"File '/mod1.ts' exist - use it as a name resolution result.",
"Resolving real path for '/mod1.ts', result '/mod1.ts'",
"======== Module name './mod1' was successfully resolved to '/mod1.ts'. ========",
"======== Resolving type reference directive 'lib', containing file '/mod1.ts', root directory '/types'. ========",
"Resolving with primary search path '/types'",
Expand All @@ -17,7 +15,6 @@
"======== Resolving module './main' from '/mod1.ts'. ========",
"Module resolution kind is not specified, using 'Classic'.",
"File '/main.ts' exist - use it as a name resolution result.",
"Resolving real path for '/main.ts', result '/main.ts'",
"======== Module name './main' was successfully resolved to '/main.ts'. ========",
"======== Resolving type reference directive 'lib', containing file '/__inferred type names__.ts', root directory '/types'. ========",
"Resolving with primary search path '/types'",
Expand Down