Skip to content

Commit

Permalink
fix(typings): restore compatibility with TS<3.8 (palantir#4933)
Browse files Browse the repository at this point in the history
Co-authored-by: Adi Dahiya <[email protected]>
  • Loading branch information
Josh Goldberg and adidahiya authored Apr 27, 2020
1 parent a66f3b3 commit 700f223
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 0 additions & 6 deletions src/language/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -582,9 +582,3 @@ export function isWhiteSpace(ch: number): boolean {
// tslint:disable-next-line
return (ts.isWhiteSpaceLike || (ts as any).isWhiteSpace)(ch);
}

/** Wrapper for compatability with typescript@<3.8.2 */
export function isPrivateIdentifier(node: ts.Node): node is ts.PrivateIdentifier {
// tslint:disable-next-line
return ts.isPrivateIdentifier ? ts.isPrivateIdentifier(node) : false;
}
8 changes: 7 additions & 1 deletion src/rules/noUnnecessaryQualifierRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ function walk(ctx: Lint.WalkContext, checker: ts.TypeChecker): void {

case ts.SyntaxKind.PropertyAccessExpression:
const { expression, name } = node as ts.PropertyAccessExpression;
if (utils.isEntityNameExpression(expression) && !Lint.isPrivateIdentifier(name)) {
if (utils.isEntityNameExpression(expression) && !isPrivateIdentifier(name)) {
visitNamespaceAccess(node, expression, name);
break;
}
Expand Down Expand Up @@ -152,3 +152,9 @@ function tryGetAliasedSymbol(symbol: ts.Symbol, checker: ts.TypeChecker): ts.Sym
? checker.getAliasedSymbol(symbol)
: undefined;
}

/** Wrapper for compatability with typescript@<3.8.2 */
function isPrivateIdentifier(node: ts.Node): node is ts.PrivateIdentifier {
// tslint:disable-next-line
return ts.isPrivateIdentifier ? ts.isPrivateIdentifier(node) : false;
}

0 comments on commit 700f223

Please sign in to comment.