Skip to content
This repository was archived by the owner on Jan 19, 2019. It is now read-only.

Commit 4d755ed

Browse files
PajnJamesHenry
authored andcommitted
New: Store type parameter constraints (fixes #188) (#189)
1 parent 29d848c commit 4d755ed

8 files changed

+1231
-6
lines changed

lib/ast-converter.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -636,7 +636,10 @@ module.exports = function(ast, extra) {
636636
typeParameter.end
637637
],
638638
loc: getLocFor(typeParameterStart, typeParameter.end, ast),
639-
name: typeParameter.name.text
639+
name: typeParameter.name.text,
640+
constraint: (typeParameter.constraint)
641+
? convertTypeAnnotation(typeParameter.constraint)
642+
: null
640643
};
641644
})
642645
};

tests/fixtures/typescript/basics/arrow-function-with-type-parameters.result.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,8 @@ module.exports = {
262262
"column": 2
263263
}
264264
},
265-
"name": "X"
265+
"name": "X",
266+
"constraint": null
266267
}
267268
]
268269
}

0 commit comments

Comments
 (0)