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

Skip to content

[@babel/[email protected]] Broken Types #17821

@RebeccaStevens

Description

@RebeccaStevens

💻

  • Would you like to work on a fix?

How are you using Babel?

@babel/eslint-parser

Input code

import * as babelParser from "@babel/eslint-parser";

Configuration file name

No response

Configuration

No response

Current and expected behavior

The package.json file contains mistakes with regards to the types -> it shouldn't.

Environment

System:
    OS: Linux 6.18 Nobara Linux 43 (KDE Plasma Desktop Edition)
  Binaries:
    Node: 24.13.1 - /home/rebec/.nvm/versions/node/v24.13.1/bin/node
    npm: 11.10.0 - /home/rebec/dev/eslint-plugin-functional/node_modules/.bin/npm
    pnpm: 10.30.1 - /home/rebec/.nvm/versions/node/v22.15.0/bin/pnpm
  npmPackages:
    @babel/eslint-parser: 8.0.0-rc.2 => 8.0.0-rc.2 
    eslint: 10.0.1 => 10.0.1 
    rollup: 4.58.0 => 4.58.0 

Possible solution

Current package.json contains:

"types": "./types.d.ts",
"exports": {
  ".": {
    "default": "./lib/index.js",
    "types": "./types.d.ts"
  },
  "./package.json": "./package.json"
},

But it should be:

"types": "./types.d.cts",
"exports": {
  ".": {
    "types": "./types.d.cts",
    "default": "./lib/index.js"
  },
  "./package.json": "./package.json"
}

The difference being the filename of the types file (the file that exists ends with .d.cts, not .d.ts) and that the default property needs to be declared last.

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions