Skip to content

Commit

Permalink
fix(eslint-plugin): [no-unnec-type-arg] undefined symbol crash (#1007)
Browse files Browse the repository at this point in the history
  • Loading branch information
quentin-jaquier-sonarsource authored and bradzacher committed Sep 24, 2019
1 parent 6279c5b commit cdf9294
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Expand Up @@ -121,7 +121,12 @@ function getTypeParametersFromType(
type: ts.EntityName | ts.Expression | ts.ClassDeclaration,
checker: ts.TypeChecker,
): readonly ts.TypeParameterDeclaration[] | undefined {
const sym = getAliasedSymbol(checker.getSymbolAtLocation(type)!, checker);
const symAtLocation = checker.getSymbolAtLocation(type);
if (symAtLocation === undefined) {
return undefined;
}

const sym = getAliasedSymbol(symAtLocation, checker);
if (sym === undefined || sym.declarations === undefined) {
return undefined;
}
Expand Down
Expand Up @@ -52,6 +52,7 @@ ruleTester.run('no-unnecessary-type-arguments', rule, {
class D<TD = number> extends C { }`,
`declare const C: unknown;
class D<TD = number> extends C { }`,
`let a: A<number>`,
],
invalid: [
{
Expand Down

0 comments on commit cdf9294

Please sign in to comment.