File tree 2 files changed +12
-1
lines changed
2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ const create = context => {
30
30
&& memberExpression . parent . type === 'VariableDeclarator'
31
31
&& memberExpression . parent . init === memberExpression
32
32
&& memberExpression . parent . id . type === 'Identifier'
33
+ && ! memberExpression . parent . id . typeAnnotation
33
34
) {
34
35
problem . fix = function * ( fixer ) {
35
36
const variable = memberExpression . parent . id ;
@@ -52,6 +53,7 @@ const create = context => {
52
53
&& memberExpression . parent . init === memberExpression
53
54
&& memberExpression . parent . id . type === 'Identifier'
54
55
&& memberExpression . parent . id . name === property . name
56
+ && ! memberExpression . parent . id . typeAnnotation
55
57
) {
56
58
problem . fix = function * ( fixer ) {
57
59
const variable = memberExpression . parent . id ;
Original file line number Diff line number Diff line change @@ -49,5 +49,14 @@ test.typescript({
49
49
valid : [
50
50
'function foo () {return (await promise) as string;}' ,
51
51
] ,
52
- invalid : [ ] ,
52
+ invalid : [
53
+ {
54
+ code : 'const foo: Type = (await promise)[0]' ,
55
+ errors : 1 ,
56
+ } ,
57
+ {
58
+ code : 'const foo: Type | A = (await promise).foo' ,
59
+ errors : 1 ,
60
+ } ,
61
+ ] ,
53
62
} ) ;
You can’t perform that action at this time.
0 commit comments