Wrong types for eslint-utils
' ReferenceTracker
#4159
Labels
accepting prs
Go ahead, send a pull request that resolves this issue
bug
Something isn't working
good first issue
Good for newcomers
package: utils
Issues related to the @typescript-eslint/utils package
Information
First off, I'd like to thank everyone involved in this project, I couldn't imagine myself linting any TS project without this wonderful set of packages.
I recently started writing a personal ESLint plugin in TypeScript, using many of the tools exported by this package.
In one of the rules I am working on, I use
eslint-utils
'ReferenceTracker
, re-exported under@typescript-eslint/experimental-utils
'ASTUtils
export. I kept getting{ ..., entry: undefined }
, no matter what I tried to track.Comparing the type given to
ReferenceTracker
in this package with the source code ineslint-utils
, it looks like a change was made a long time ago to the return value, such that any info saved in the TraceMap was returned on theinfo
field, rather than theentry
one. Could it be that the types are simply out of date? From what I see the type was changed around v1 ofeslint-utils
, in my case, using v3 ofeslint-utils
, the types declared by this package don't match the types ofeslint-utils
.Repro
Expected Result
Logging
result.entry
to the console should output{some: 'information'}
, loggingresult['info']
should output undefined, as the types suggest.Actual Result
The reverse,
result.entry
is empty,result['info']
isn't.Additional Info
As can be seen in JSDoc comments here, here and here, and in tests for the same file, the information stored in the trace map is returned under the
info
field of the object, and not theentry
field.Versions
@typescript-eslint/experimental-utils
5.3.1
TypeScript
4.4.4
node
14.18.0
eslint-utils
3.0.0
The text was updated successfully, but these errors were encountered: