Skip to content

Bug: TSImportType's option object always has key with #11114

Closed
@overlookmotel

Description

@overlookmotel

Before You File a Bug Report Please Confirm You Have Done The Following...

  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest version of the packages.
  • I have searched for related issues and found none that matched my issue.
  • I have read the FAQ and my problem is not listed.

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

type T = import("m", { with: { "resolution-mode": "import" } });
type U = import("m", { assert: { "resolution-mode": "import" } });

ESLint Config

tsconfig

Expected Result

Both statements include a TSImportType with an options property containing an ObjectExpression. Both ObjectExpressions have a single Property.

The key of Property in 1st statement is with.

The key of Property in 2nd statement is also with! I'd have expected it to be assert.

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

package version
@typescript-eslint/parser 8.31.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    ASTPRs and Issues about the AST structureaccepting prsGo ahead, send a pull request that resolves this issuebugSomething isn't workinglocked due to agePlease open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing.package: typescript-estreeIssues related to @typescript-eslint/typescript-estree

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy