Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

Internalized isPrivateIdentifier helper #4933

Merged
merged 2 commits into from
Apr 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
}