Skip to content

bug: Syntax error in index.d.cts in v0.9.5-5 (TS1128)Β #115

@rafalx89

Description

@rafalx89

πŸ› Bug Report

After upgrading from 0.9.5-4 to 0.9.5-5, the TypeScript compilation fails with a syntax error in the generated declaration file. It seems like the build process corrupted the end of the index.d.cts file by concatenating the source map comment with the export statements and leaving a dangling closing brace.

ERROR in ./node_modules/react-floater/dist/index.d.cts
[tsl] ERROR in ./node_modules/react-floater/dist/index.d.cts(163,1)
      TS1128: Declaration or statement expected.

Problematic code in dist/index.d.cts:
The end of the file currently looks like this:

declare function ReactFloater(props: Props): react_jsx_runtime0.JSX.Element | null;

//# sourceMappingURL=index.d.cts.map    export { type Action, type CustomComponentProps, type Placement, type PopperInstance, type Props, type Styles, ReactFloater as default };
}

export = ReactFloater;

Issues identified:
Comment concatenation: The export statement is on the same line as //# sourceMappingURL, which causes the compiler to treat the exports as a comment.

Dangling brace: There is a closing brace } on line 164 with no matching opening brace, which triggers the TS1128 error.

To Reproduce

Install the specific version of the package in a TypeScript-enabled project:

Bash
npm install react-floater@0.9.5-5
Run a build (e.g., using Webpack with ts-loader or simply run tsc):

Bash
npm run build
# or
npx tsc --noEmit

Expected behavior

The file should probably end like this:

declare function ReactFloater(props: Props): react_jsx_runtime0.JSX.Element | null;

export { type Action, type CustomComponentProps, type Placement, type PopperInstance, type Props, type Styles, ReactFloater as default };

export = ReactFloater;

//# sourceMappingURL=index.d.cts.map

Link to repl or repo (highly encouraged)

https://www.npmjs.com/package/react-floater/v/0.9.5-5?activeTab=code

Run npx envinfo --system --binaries --npmPackages react-floater

Paste the results here:

  System:
    OS: macOS 26.3.1
    CPU: (14) arm64 Apple M4 Pro
    Memory: 3.28 GB / 48.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 20.20.0 - /Users/rafal.nvm/versions/node/v20.20.0/bin/node
    npm: 10.8.2 - /Users/rafal/.nvm/versions/node/v20.20.0/bin/npm

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions