@@ -1087,8 +1087,10 @@ module.exports = function(ast, extra) {
1087
1087
// TODO: double-check that these positions are correct
1088
1088
var methodLoc = ast . getLineAndCharacterOfPosition ( node . name . end + 1 ) ,
1089
1089
nodeIsMethod = ( node . kind === SyntaxKind . MethodDeclaration ) ,
1090
+ isAmbient = ts . isInAmbientContext ( node ) ,
1091
+ type = ( ! isAmbient ) ? "FunctionExpression" : "TSAmbientFunctionExpression" ,
1090
1092
method = {
1091
- type : "FunctionExpression" ,
1093
+ type : type ,
1092
1094
id : null ,
1093
1095
generator : false ,
1094
1096
expression : false ,
@@ -1149,6 +1151,9 @@ module.exports = function(ast, extra) {
1149
1151
methodDefinitionType = "TSAbstractMethodDefinition" ;
1150
1152
}
1151
1153
}
1154
+ if ( isAmbient ) {
1155
+ methodDefinitionType = "TSAmbientMethodDefinition" ;
1156
+ }
1152
1157
1153
1158
assign ( result , {
1154
1159
type : methodDefinitionType ,
@@ -1180,8 +1185,10 @@ module.exports = function(ast, extra) {
1180
1185
var constructorIsStatic = Boolean ( ts . getModifierFlags ( node ) & ts . ModifierFlags . Static ) ,
1181
1186
firstConstructorToken = constructorIsStatic ? ts . findNextToken ( node . getFirstToken ( ) , ast ) : node . getFirstToken ( ) ,
1182
1187
constructorLoc = ast . getLineAndCharacterOfPosition ( node . parameters . pos - 1 ) ,
1188
+ constructorIsAmbient = ts . isInAmbientContext ( node ) ,
1189
+ constructorType = ( ! constructorIsAmbient ) ? "FunctionExpression" : "TSAmbientFunctionExpression" ,
1183
1190
constructor = {
1184
- type : "FunctionExpression" ,
1191
+ type : constructorType ,
1185
1192
id : null ,
1186
1193
params : node . parameters . map ( function ( param ) {
1187
1194
var convertedParam = convertChild ( param ) ;
@@ -1244,7 +1251,7 @@ module.exports = function(ast, extra) {
1244
1251
}
1245
1252
1246
1253
assign ( result , {
1247
- type : "MethodDefinition" ,
1254
+ type : ( ! constructorIsAmbient ) ? "MethodDefinition" : "TSAmbientMethodDefintion ",
1248
1255
key : constructorKey ,
1249
1256
value : constructor ,
1250
1257
computed : constructorIsComputed ,
0 commit comments