Skip to content

Commit 0d33019

Browse files
authored
Add missing parens in type serializer (#3743)
1 parent 16ff7f0 commit 0d33019

6 files changed

Lines changed: 3 additions & 30 deletions

internal/transformers/tstransforms/typeserializer.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ func (s *metadataSerializer) serializeUnionOrIntersectionConstituents(types []*a
260260
return s.f.NewIdentifier("Object") // Reduce to `any` in a union or intersection
261261
}
262262

263-
if !s.strictNullChecks && (ast.IsLiteralTypeNode(typeNode) && typeNode.AsLiteralTypeNode().Literal.Kind == ast.KindNullKeyword) || typeNode.Kind == ast.KindUndefinedKeyword {
263+
if !s.strictNullChecks && ((ast.IsLiteralTypeNode(typeNode) && typeNode.AsLiteralTypeNode().Literal.Kind == ast.KindNullKeyword) || typeNode.Kind == ast.KindUndefinedKeyword) {
264264
continue // Elide null and undefined from unions for metadata, just like what we did prior to the implementation of strict null checks
265265
}
266266

testdata/baselines/reference/submodule/compiler/metadataOfUnionWithNull(strictnullchecks=true).js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ __decorate([
7070
], B.prototype, "y", void 0);
7171
__decorate([
7272
PropDeco,
73-
__metadata("design:type", String)
73+
__metadata("design:type", Object)
7474
], B.prototype, "z", void 0);
7575
__decorate([
7676
PropDeco,

testdata/baselines/reference/submodule/compiler/metadataReferencedWithinFilteredUnion(strictnullchecks=true,target=es2015).js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class Class2 {
5454
exports.Class2 = Class2;
5555
__decorate([
5656
decorate,
57-
__metadata("design:type", Class1_1.Class1),
57+
__metadata("design:type", Object),
5858
__metadata("design:paramtypes", [])
5959
], Class2.prototype, "maybeProp", null);
6060
__decorate([

testdata/baselines/reference/submoduleTriaged/compiler/metadataOfUnionWithNull(strictnullchecks=true).js.diff

Lines changed: 0 additions & 11 deletions
This file was deleted.

testdata/baselines/reference/submoduleTriaged/compiler/metadataReferencedWithinFilteredUnion(strictnullchecks=true,target=es2015).js.diff

Lines changed: 0 additions & 11 deletions
This file was deleted.

testdata/submoduleTriaged.txt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -153,11 +153,6 @@ conformance/moduleExportsElementAccessAssignment.js.diff
153153
## https://github.com/microsoft/typescript-go/issues/3547
154154
conformance/typeFromPropertyAssignment39.js.diff
155155

156-
# Decorator metadata reflects stable union type ordering
157-
## https://github.com/microsoft/typescript-go/issues/3548
158-
compiler/metadataOfUnionWithNull(strictnullchecks=true).js.diff
159-
compiler/metadataReferencedWithinFilteredUnion(strictnullchecks=true,target=es2015).js.diff
160-
161156
# Missing generic type arguments no longer auto-filled with any (produces TS2314 errors)
162157
## https://github.com/microsoft/typescript-go/issues/3549
163158
conformance/jsDeclarationsMissingGenerics(target=es2015).js.diff

0 commit comments

Comments
 (0)