Typescript function destructured params (#9431)

* fix typescript funtion destructured params for array

* update type name
This commit is contained in:
Downpooooour
2019-02-08 05:59:50 +08:00
committed by Nicolò Ribaudo
parent fdb65ab8b1
commit d1514f57bd
4 changed files with 173 additions and 10 deletions

View File

@@ -1 +1,3 @@
type MyType = ({ theme }: any) => any
type AnotherType = ([a]: any) => any

View File

@@ -1,29 +1,29 @@
{
"type": "File",
"start": 0,
"end": 37,
"end": 75,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 37
"line": 3,
"column": 36
}
},
"program": {
"type": "Program",
"start": 0,
"end": 37,
"end": 75,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 37
"line": 3,
"column": 36
}
},
"sourceType": "module",
@@ -209,6 +209,149 @@
}
}
}
},
{
"type": "TSTypeAliasDeclaration",
"start": 39,
"end": 75,
"loc": {
"start": {
"line": 3,
"column": 0
},
"end": {
"line": 3,
"column": 36
}
},
"id": {
"type": "Identifier",
"start": 44,
"end": 55,
"loc": {
"start": {
"line": 3,
"column": 5
},
"end": {
"line": 3,
"column": 16
},
"identifierName": "AnotherType"
},
"name": "AnotherType"
},
"typeAnnotation": {
"type": "TSFunctionType",
"start": 58,
"end": 75,
"loc": {
"start": {
"line": 3,
"column": 19
},
"end": {
"line": 3,
"column": 36
}
},
"parameters": [
{
"type": "ArrayPattern",
"start": 59,
"end": 67,
"loc": {
"start": {
"line": 3,
"column": 20
},
"end": {
"line": 3,
"column": 28
}
},
"elements": [
{
"type": "Identifier",
"start": 60,
"end": 61,
"loc": {
"start": {
"line": 3,
"column": 21
},
"end": {
"line": 3,
"column": 22
},
"identifierName": "a"
},
"name": "a"
}
],
"typeAnnotation": {
"type": "TSTypeAnnotation",
"start": 62,
"end": 67,
"loc": {
"start": {
"line": 3,
"column": 23
},
"end": {
"line": 3,
"column": 28
}
},
"typeAnnotation": {
"type": "TSAnyKeyword",
"start": 64,
"end": 67,
"loc": {
"start": {
"line": 3,
"column": 25
},
"end": {
"line": 3,
"column": 28
}
}
}
}
}
],
"typeAnnotation": {
"type": "TSTypeAnnotation",
"start": 69,
"end": 75,
"loc": {
"start": {
"line": 3,
"column": 30
},
"end": {
"line": 3,
"column": 36
}
},
"typeAnnotation": {
"type": "TSAnyKeyword",
"start": 72,
"end": 75,
"loc": {
"start": {
"line": 3,
"column": 33
},
"end": {
"line": 3,
"column": 36
}
}
}
}
}
}
],
"directives": []