-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Bug: TSImportType
's option
object always has key with
#11114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Actually, there is a way to differentiate between the two - the That's a pretty odd workaround, but as far as I'm aware, |
…` in TS-ESTree AST (#10681) TS-ESLint parser replaces a property of `options` called `assert` with one called `with`. typescript-eslint/typescript-eslint#11114 This looks like it's an error on their side, but in the meantime replicate this behavior.
the reason this happens is because TS doesn't differentiate between the two and our code just blindly grabs the token without checking its text -- which is why the range is correct but the name is not. typescript-eslint/packages/typescript-estree/src/convert.ts Lines 3121 to 3139 in 50ef8d9
|
Thanks very much for coming back so swiftly, and pointing me to the right place. PR to fix: #11115. |
Before You File a Bug Report Please Confirm You Have Done The Following...
Relevant Package
typescript-estree
Playground Link
https://typescript-eslint.io/play/#ts=5.8.2&showAST=es&fileType=.tsx&code=C4TwDgpgBAKlC8UCWBbMB7ATsAFAIhTwBooBvKAdyWAAsAuMqPTCAZ3QBsBXYJdAOwC0KdABMIeBnlQZseKAF9FASgDcAKFCQoAVQTI0WXAWKMAhq1YRsDcszacefISPGSmMo-KUK16oA&eslintrc=N4KABGBEBOCuA2BTAzpAXGYBfEWg&tsconfig=N4KABGBEDGD2C2AHAlgGwKYCcDyiAuysAdgM6QBcYoEEkJemy0eAcgK6qoDCAFutAGsylBm3TgwAXxCSgA&tokens=false
Repro Code
ESLint Config
tsconfig
Expected Result
Both statements include a
TSImportType
with anoptions
property containing anObjectExpression
. BothObjectExpression
s have a singleProperty
.The key of
Property
in 1st statement iswith
.The key of
Property
in 2nd statement is alsowith
! I'd have expected it to beassert
.Actual Result
(see above)
Additional Info
I think this is a bug. But apologies if this is a stupid query. I don't know TypeScript at all well.
I notice that TypeScript's AST doesn't seem to differentiate between the two either, so maybe it's not possible for TS-ESLint to?
Versions
@typescript-eslint/parser
8.31.1
The text was updated successfully, but these errors were encountered: