@@ -1098,8 +1098,10 @@ module.exports = function(ast, extra) {
1098
1098
// TODO: double-check that these positions are correct
1099
1099
var methodLoc = ast . getLineAndCharacterOfPosition ( node . name . end + 1 ) ,
1100
1100
nodeIsMethod = ( node . kind === SyntaxKind . MethodDeclaration ) ,
1101
+ isAmbient = ts . isInAmbientContext ( node ) ,
1102
+ type = ( ! isAmbient ) ? "FunctionExpression" : "TSAmbientFunctionExpression" ,
1101
1103
method = {
1102
- type : "FunctionExpression" ,
1104
+ type : type ,
1103
1105
id : null ,
1104
1106
generator : false ,
1105
1107
expression : false ,
@@ -1160,6 +1162,9 @@ module.exports = function(ast, extra) {
1160
1162
methodDefinitionType = "TSAbstractMethodDefinition" ;
1161
1163
}
1162
1164
}
1165
+ if ( isAmbient ) {
1166
+ methodDefinitionType = "TSAmbientMethodDefinition" ;
1167
+ }
1163
1168
1164
1169
assign ( result , {
1165
1170
type : methodDefinitionType ,
@@ -1191,8 +1196,10 @@ module.exports = function(ast, extra) {
1191
1196
var constructorIsStatic = Boolean ( ts . getModifierFlags ( node ) & ts . ModifierFlags . Static ) ,
1192
1197
firstConstructorToken = constructorIsStatic ? ts . findNextToken ( node . getFirstToken ( ) , ast ) : node . getFirstToken ( ) ,
1193
1198
constructorLoc = ast . getLineAndCharacterOfPosition ( node . parameters . pos - 1 ) ,
1199
+ constructorIsAmbient = ts . isInAmbientContext ( node ) ,
1200
+ constructorType = ( ! constructorIsAmbient ) ? "FunctionExpression" : "TSAmbientFunctionExpression" ,
1194
1201
constructor = {
1195
- type : "FunctionExpression" ,
1202
+ type : constructorType ,
1196
1203
id : null ,
1197
1204
params : node . parameters . map ( function ( param ) {
1198
1205
var convertedParam = convertChild ( param ) ;
@@ -1255,7 +1262,7 @@ module.exports = function(ast, extra) {
1255
1262
}
1256
1263
1257
1264
assign ( result , {
1258
- type : "MethodDefinition" ,
1265
+ type : ( ! constructorIsAmbient ) ? "MethodDefinition" : "TSAmbientMethodDefintion ",
1259
1266
key : constructorKey ,
1260
1267
value : constructor ,
1261
1268
computed : constructorIsComputed ,
0 commit comments