Skip to content

Commit e363c75

Browse files
committed
Revert baseline changes to the objectTypeLiteralSyntax2 test
1 parent d9d67d9 commit e363c75

File tree

2 files changed

+8
-12
lines changed

2 files changed

+8
-12
lines changed

src/compiler/parser.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2248,10 +2248,12 @@ namespace ts {
22482248
property.questionToken = questionToken;
22492249
property.type = parseTypeAnnotation();
22502250

2251-
// Although object type properties cannot not have initializers, we attempt to parse an initializer
2252-
// so we can report in the checker that an interface property or object type literal property cannot
2253-
// have an initializer.
2254-
property.initializer = parseNonParameterInitializer();
2251+
if (token === SyntaxKind.EqualsToken) {
2252+
// Although object type properties cannot not have initializers, we attempt
2253+
// to parse an initializer so we can report in the checker that an interface
2254+
// property or object type literal property cannot have an initializer.
2255+
property.initializer = parseNonParameterInitializer();
2256+
}
22552257

22562258
parseTypeMemberSemicolon();
22572259
return finishNode(property);
Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
tests/cases/conformance/types/objectTypeLiteral/objectTypeLiteralSyntax2.ts(12,22): error TS1005: '=' expected.
2-
tests/cases/conformance/types/objectTypeLiteral/objectTypeLiteralSyntax2.ts(12,22): error TS2304: Cannot find name 'bar'.
3-
tests/cases/conformance/types/objectTypeLiteral/objectTypeLiteralSyntax2.ts(12,25): error TS1005: ';' expected.
1+
tests/cases/conformance/types/objectTypeLiteral/objectTypeLiteralSyntax2.ts(12,22): error TS1005: ';' expected.
42

53

6-
==== tests/cases/conformance/types/objectTypeLiteral/objectTypeLiteralSyntax2.ts (3 errors) ====
4+
==== tests/cases/conformance/types/objectTypeLiteral/objectTypeLiteralSyntax2.ts (1 errors) ====
75
var x: {
86
foo: string,
97
bar: string
@@ -17,8 +15,4 @@ tests/cases/conformance/types/objectTypeLiteral/objectTypeLiteralSyntax2.ts(12,2
1715

1816
var z: { foo: string bar: string }
1917
~~~
20-
!!! error TS1005: '=' expected.
21-
~~~
22-
!!! error TS2304: Cannot find name 'bar'.
23-
~
2418
!!! error TS1005: ';' expected.

0 commit comments

Comments
 (0)