@@ -905,7 +905,7 @@ module.exports = function(ast, extra) {
905
905
return modifier . kind === ts . SyntaxKind . DeclareKeyword ;
906
906
} ) ;
907
907
if ( isDeclareFunction ) {
908
- functionDeclarationType = "DeclareFunction " ;
908
+ functionDeclarationType = "TSAmbientFunctionDeclaration " ;
909
909
}
910
910
}
911
911
@@ -1105,6 +1105,7 @@ module.exports = function(ast, extra) {
1105
1105
// TODO: double-check that these positions are correct
1106
1106
var methodLoc = ast . getLineAndCharacterOfPosition ( node . name . end + 1 ) ,
1107
1107
nodeIsMethod = ( node . kind === SyntaxKind . MethodDeclaration ) ,
1108
+ isAmbient = ts . isInAmbientContext ( node ) ,
1108
1109
method = {
1109
1110
type : "FunctionExpression" ,
1110
1111
id : null ,
@@ -1167,6 +1168,10 @@ module.exports = function(ast, extra) {
1167
1168
methodDefinitionType = "TSAbstractMethodDefinition" ;
1168
1169
}
1169
1170
}
1171
+ if ( isAmbient ) {
1172
+ methodDefinitionType = "TSAmbientMethodDefinition" ;
1173
+ method . type = "TSAmbientFunctionExpression" ;
1174
+ }
1170
1175
1171
1176
assign ( result , {
1172
1177
type : methodDefinitionType ,
@@ -1198,6 +1203,7 @@ module.exports = function(ast, extra) {
1198
1203
var constructorIsStatic = Boolean ( ts . getModifierFlags ( node ) & ts . ModifierFlags . Static ) ,
1199
1204
firstConstructorToken = constructorIsStatic ? ts . findNextToken ( node . getFirstToken ( ) , ast ) : node . getFirstToken ( ) ,
1200
1205
constructorLoc = ast . getLineAndCharacterOfPosition ( node . parameters . pos - 1 ) ,
1206
+ constructorIsAmbient = ts . isInAmbientContext ( node ) ,
1201
1207
constructor = {
1202
1208
type : "FunctionExpression" ,
1203
1209
id : null ,
@@ -1278,8 +1284,14 @@ module.exports = function(ast, extra) {
1278
1284
} ;
1279
1285
}
1280
1286
1287
+ var constructorMethodDefinitionType = "MethodDefinition" ;
1288
+ if ( constructorIsAmbient ) {
1289
+ constructorMethodDefinitionType = "TSAmbientMethodDefinition" ;
1290
+ constructor . type = "TSAmbientFunctionExpression" ;
1291
+ }
1292
+
1281
1293
assign ( result , {
1282
- type : "MethodDefinition" ,
1294
+ type : constructorMethodDefinitionType ,
1283
1295
key : constructorKey ,
1284
1296
value : constructor ,
1285
1297
computed : constructorIsComputed ,
0 commit comments