@@ -1074,8 +1074,10 @@ 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 ) ,
1078
+ type = ( ! isAmbient ) ? "FunctionExpression" : "TSAmbientFunctionExpression" ,
1077
1079
method = {
1078
- type : "FunctionExpression" ,
1080
+ type : type ,
1079
1081
id : null ,
1080
1082
generator : false ,
1081
1083
expression : false ,
@@ -1136,6 +1138,9 @@ module.exports = function(ast, extra) {
1136
1138
methodDefinitionType = "TSAbstractMethodDefinition" ;
1137
1139
}
1138
1140
}
1141
+ if ( isAmbient ) {
1142
+ methodDefinitionType = "TSAmbientMethodDefinition" ;
1143
+ }
1139
1144
1140
1145
assign ( result , {
1141
1146
type : methodDefinitionType ,
@@ -1167,8 +1172,10 @@ 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 ) ,
1176
+ constructorType = ( ! constructorIsAmbient ) ? "FunctionExpression" : "TSAmbientFunctionExpression" ,
1170
1177
constructor = {
1171
- type : "FunctionExpression" ,
1178
+ type : constructorType ,
1172
1179
id : null ,
1173
1180
params : node . parameters . map ( function ( param ) {
1174
1181
var convertedParam = convertChild ( param ) ;
@@ -1231,7 +1238,7 @@ module.exports = function(ast, extra) {
1231
1238
}
1232
1239
1233
1240
assign ( result , {
1234
- type : "MethodDefinition" ,
1241
+ type : ( ! constructorIsAmbient ) ? "MethodDefinition" : "TSAmbientMethodDefintion ",
1235
1242
key : constructorKey ,
1236
1243
value : constructor ,
1237
1244
computed : constructorIsComputed ,
0 commit comments