Skip to content

error TS1046: Top-level declarations in .d.ts files must start with either a 'declare' or 'export' modifier. #922

@juninhodeluca

Description

@juninhodeluca

After last update I'm getting the following error when building

Step 9/23 : RUN pnpm build
 ---> Running in b782a7fbad46

> voice-assistants@0.1.0 build /app
> tsc

node_modules/@livekit/protocol/dist/index.d.mts(11473,1): error TS1046: Top-level declarations in .d.ts files must start with either a 'declare' or 'export' modifier.
 ELIFECYCLE  Command failed with exit code 2.
Cleaning up...
 - No resources found
build [voice-assistants] failed: docker build failure: The command '/bin/sh -c pnpm build' returned a non-zero code: 2. Please fix the Dockerfile and try again..

my package.json deps

"dependencies": {
    "@livekit/agents": "^0.5.1",
    "@livekit/agents-plugin-openai": "^0.7.1",
    "@livekit/agents-plugin-silero": "^0.5.0",
    "@livekit/rtc-node": "^0.12.1",
    "axios": "^1.7.8",
    "dotenv": "^16.4.5",
    "form-data": "^4.0.1",
    "livekit-server-sdk": "^2.9.3",
    "lodash": "^4.17.21",
    "mongoose": "^8.8.3",
    "uuid": "^11.0.2",
    "zod": "^3.23.8"
  }

The error origin is at node_modules/@livekit/protocol/dist/index.d.mts(11473,1), as present in log.
Specifically in the index.d.mts file (line 11473)

const version = "1.29.3";

should be

export const version = "1.29.3";

or may could be also removed, since the file index.cjs at line 6011 there are also a version constant

// line 6011
const version = "1.29.3";

which is exported at line 6260

// line 6260
exports.version = version;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions