@@ -74,7 +74,10 @@ export function createTypeTracker(context: Rule.RuleContext): TypeTracker {
7474
7575 const { tsNodeMap, checker, usedTS } = getTypeScriptTools ( context )
7676
77- const cacheTypeInfo = new WeakMap < ES . Expression , TypeInfo | null > ( )
77+ const cacheTypeInfo = new WeakMap <
78+ ES . Expression | ES . PrivateIdentifier ,
79+ TypeInfo | null
80+ > ( )
7881
7982 const tracker : TypeTracker = {
8083 isString,
@@ -129,7 +132,9 @@ export function createTypeTracker(context: Rule.RuleContext): TypeTracker {
129132 /**
130133 * Get the type name from given node.
131134 */
132- function getType ( node : ES . Expression ) : TypeInfo | null {
135+ function getType (
136+ node : ES . Expression | ES . PrivateIdentifier ,
137+ ) : TypeInfo | null {
133138 if ( cacheTypeInfo . has ( node ) ) {
134139 return cacheTypeInfo . get ( node ) ?? null
135140 }
@@ -147,7 +152,9 @@ export function createTypeTracker(context: Rule.RuleContext): TypeTracker {
147152 /**
148153 * Get the type name from given node.
149154 */
150- function getTypeWithoutCache ( node : ES . Expression ) : TypeInfo | null {
155+ function getTypeWithoutCache (
156+ node : ES . Expression | ES . PrivateIdentifier ,
157+ ) : TypeInfo | null {
151158 if ( node . type === "Literal" ) {
152159 if ( typeof node . value === "string" ) {
153160 return STRING
@@ -511,7 +518,9 @@ export function createTypeTracker(context: Rule.RuleContext): TypeTracker {
511518 /**
512519 * Get type from given node by ts types.
513520 */
514- function getTypeByTs ( node : ES . Expression ) : TypeInfo | null {
521+ function getTypeByTs (
522+ node : ES . Expression | ES . PrivateIdentifier ,
523+ ) : TypeInfo | null {
515524 const tsNode = tsNodeMap . get ( node )
516525 const tsType = ( tsNode && checker ?. getTypeAtLocation ( tsNode ) ) || null
517526 return tsType && getTypeFromTsType ( tsType )
0 commit comments