Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Bug: Declaration of type-only TSESTree namespace should be type-only syntactically #11310

Closed
@molisani

Description

@molisani

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

types

Playground Link

No response

Repro Code

import { TSESTree } from "@typescript-eslint/types";
import type { TSESTree } from "@typescript-eslint/types";

ESLint Config

tsconfig

{
  "compilerOptions": {
    "verbatimModuleSyntax": true
  }
}

Expected Result

The first line should have the following error, which can be solved by switching it to the second line.

'TSESTree' resolves to a type-only declaration and must be imported using a type-only import when 'verbatimModuleSyntax' is enabled.ts(1485)

Actual Result

Both lines result in no errors. When this is transpiled with verbatimModuleSyntax the non-type-only import statement ends up in the transpiled .js output file which fails at runtime (as there is no TSESTree value import).

Additional Info

This should be incredibly easy to fix, expect a PR shortly.

Versions

package version
@typescript-eslint/types 8.22.0
TypeScript 5.8.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriageWaiting for team members to take a look

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions