Skip to content

Commit 153cdb8

Browse files
duailibeJamesHenry
authored andcommitted
Fix: Calculate end position of TypeInstantiation (fixes eslint#406) (eslint#405)
1 parent 678907b commit 153cdb8

File tree

3 files changed

+481
-3
lines changed

3 files changed

+481
-3
lines changed

lib/convert.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,10 @@ module.exports = function convert(config) {
112112
const firstTypeArgument = typeArguments[0];
113113
const typeArgumentsParent = firstTypeArgument.parent;
114114
/**
115-
* In the case of the parent being a CallExpression we have to use slightly different
116-
* logic to calculate the correct end position
115+
* In the case of the parent being a CallExpression or a TypeReference we have to use
116+
* slightly different logic to calculate the correct end position
117117
*/
118-
if (typeArgumentsParent && typeArgumentsParent.kind === SyntaxKind.CallExpression) {
118+
if (typeArgumentsParent && (typeArgumentsParent.kind === SyntaxKind.CallExpression || typeArgumentsParent.kind === SyntaxKind.TypeReference)) {
119119
const lastTypeArgument = typeArguments[typeArguments.length - 1];
120120
const greaterThanToken = nodeUtils.findNextToken(lastTypeArgument, ast);
121121
end = greaterThanToken.end;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
class AudioBufferList {
2+
mBuffers: interop.Reference<any /*AudioBuffer*/>;
3+
}

0 commit comments

Comments
 (0)