Skip to content
This repository was archived by the owner on Jan 14, 2019. It is now read-only.

Commit 9b575de

Browse files
armano2JamesHenry
authored andcommitted
feat(diagnostics): report on TS 1096 (#110)
1 parent 66ae047 commit 9b575de

24 files changed

+19689
-10381
lines changed

src/semantic-errors.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ function whitelistSupportedDiagnostics(
6060
case 1048: // ts 3.2 "A rest parameter cannot have an initializer."
6161
case 1049: // ts 3.2 "A 'set' accessor must have exactly one parameter."
6262
case 1090: // ts 3.2 "'{0}' modifier cannot appear on a parameter."
63+
case 1096: // ts 3.2 "An index signature must have exactly one parameter."
6364
case 1097: // ts 3.2 "'{0}' list cannot be empty."
6465
case 1117: // ts 3.2 "An object literal cannot have multiple properties with the same name in strict mode."
6566
case 1121: // ts 3.2 "Octal literals are not allowed in strict mode."

tests/ast-alignment/fixtures-to-test.ts

Lines changed: 40 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,12 @@ tester.addFixturePatternConfig('javascript/experimentalOptionalCatchBinding');
194194
tester.addFixturePatternConfig('javascript/for');
195195
tester.addFixturePatternConfig('javascript/forIn', {
196196
ignore: [
197+
/**
198+
* Error: AST difference
199+
* ts-estree: ArrayPattern
200+
* babel: ArrayExpression
201+
*/
202+
'for-in-array',
197203
/**
198204
* Error: AST difference
199205
* ts-estree: AssignmentExpression
@@ -213,7 +219,16 @@ tester.addFixturePatternConfig('javascript/forIn', {
213219
]
214220
});
215221

216-
tester.addFixturePatternConfig('javascript/forOf');
222+
tester.addFixturePatternConfig('javascript/forOf', {
223+
ignore: [
224+
/**
225+
* Error: AST difference
226+
* ts-estree: ArrayPattern
227+
* babel: ArrayExpression
228+
*/
229+
'for-of-array'
230+
]
231+
});
217232
tester.addFixturePatternConfig('javascript/generators');
218233
tester.addFixturePatternConfig('javascript/globalReturn');
219234
tester.addFixturePatternConfig('javascript/importMeta');
@@ -336,6 +351,15 @@ tester.addFixturePatternConfig('typescript/basics', {
336351
'class-with-implements-generic',
337352
'class-with-implements',
338353
'class-with-extends-and-implements',
354+
/**
355+
* Babel error: parameterName is not included into range of TSTypeAnnotation
356+
* TODO: report it to babel
357+
*/
358+
'type-guard-in-method',
359+
/**
360+
* there is difference in range between babel and ts-estree
361+
*/
362+
'export-declare-const-named-enum',
339363
/**
340364
* Other major AST differences (e.g. fundamentally different node types)
341365
*/
@@ -349,10 +373,18 @@ tester.addFixturePatternConfig('typescript/basics', {
349373
'interface-with-jsdoc',
350374
'interface-with-optional-properties',
351375
'interface-without-type-annotation',
376+
'interface-with-method',
377+
'type-guard-in-interface',
378+
'typed-method-signature',
352379
'typed-this',
380+
/**
381+
* Babel bug for parsing exported abstract interface
382+
* https://github.com/babel/babel/issues/9304
383+
*/
353384
'abstract-interface',
354385
/**
355-
* Babel bug for optional or abstract methods?
386+
* Babel bug for optional or abstract methods
387+
* https://github.com/babel/babel/issues/9305
356388
*/
357389
'abstract-class-with-abstract-method', // babel parse errors
358390
'abstract-class-with-optional-method', // babel parse errors
@@ -366,8 +398,8 @@ tester.addFixturePatternConfig('typescript/basics', {
366398
'class-with-public-parameter-properties',
367399
'class-with-readonly-parameter-properties',
368400
/**
369-
* Not yet supported in Babel https://github.com/babel/babel/issues/7749
370-
* WIP PR is https://github.com/babel/babel/pull/8798
401+
* PR for type import has been merged into Babel: https://github.com/babel/babel/pull/9302
402+
* TODO: remove me in next babel > 7.2.3
371403
*/
372404
'import-type',
373405
'import-type-with-type-parameters-in-type-reference',
@@ -444,7 +476,10 @@ tester.addFixturePatternConfig('typescript/types', {
444476
* AST difference
445477
*/
446478
'function-with-rest',
447-
'constructor-with-rest'
479+
'constructor-with-rest',
480+
'index-signature',
481+
'index-signature-readonly',
482+
'literal-number-negative'
448483
]
449484
});
450485

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
for (i in []) {}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
for (var {name, value} in obj) {}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
for (i in {}) {}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
for (let x of [])
2+
doSomething();
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
for (var {name, value} of obj) {}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
for (var [name, value] of obj) {}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
for (let x of {})
2+
doSomething();
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export declare const enum Foo {
2+
foo = 1,
3+
bar
4+
}

0 commit comments

Comments
 (0)