@@ -875,7 +875,7 @@ module.exports = function(ast, extra) {
875
875
return modifier . kind === ts . SyntaxKind . DeclareKeyword ;
876
876
} ) ;
877
877
if ( isDeclareFunction ) {
878
- functionDeclarationType = "DeclareFunction " ;
878
+ functionDeclarationType = "TSAmbientFunctionDeclaration " ;
879
879
}
880
880
}
881
881
@@ -1074,6 +1074,7 @@ module.exports = function(ast, extra) {
1074
1074
// TODO: double-check that these positions are correct
1075
1075
var methodLoc = ast . getLineAndCharacterOfPosition ( node . name . end + 1 ) ,
1076
1076
nodeIsMethod = ( node . kind === SyntaxKind . MethodDeclaration ) ,
1077
+ isAmbient = ts . isInAmbientContext ( node ) ,
1077
1078
method = {
1078
1079
type : "FunctionExpression" ,
1079
1080
id : null ,
@@ -1136,6 +1137,10 @@ module.exports = function(ast, extra) {
1136
1137
methodDefinitionType = "TSAbstractMethodDefinition" ;
1137
1138
}
1138
1139
}
1140
+ if ( isAmbient ) {
1141
+ methodDefinitionType = "TSAmbientMethodDefinition" ;
1142
+ method . type = "TSAmbientFunctionExpression" ;
1143
+ }
1139
1144
1140
1145
assign ( result , {
1141
1146
type : methodDefinitionType ,
@@ -1167,6 +1172,7 @@ module.exports = function(ast, extra) {
1167
1172
var constructorIsStatic = Boolean ( node . flags & ts . NodeFlags . Static ) ,
1168
1173
firstConstructorToken = constructorIsStatic ? ts . findNextToken ( node . getFirstToken ( ) , ast ) : node . getFirstToken ( ) ,
1169
1174
constructorLoc = ast . getLineAndCharacterOfPosition ( node . parameters . pos - 1 ) ,
1175
+ constructorIsAmbient = ts . isInAmbientContext ( node ) ,
1170
1176
constructor = {
1171
1177
type : "FunctionExpression" ,
1172
1178
id : null ,
@@ -1230,8 +1236,14 @@ module.exports = function(ast, extra) {
1230
1236
} ;
1231
1237
}
1232
1238
1239
+ var constructorMethodDefinitionType = "MethodDefinition" ;
1240
+ if ( constructorIsAmbient ) {
1241
+ constructorMethodDefinitionType = "TSAmbientMethodDefinition" ;
1242
+ constructor . type = "TSAmbientFunctionExpression" ;
1243
+ }
1244
+
1233
1245
assign ( result , {
1234
- type : "MethodDefinition" ,
1246
+ type : constructorMethodDefinitionType ,
1235
1247
key : constructorKey ,
1236
1248
value : constructor ,
1237
1249
computed : constructorIsComputed ,
0 commit comments