Skip to content

Conversation

@1egoman
Copy link
Contributor

@1egoman 1egoman commented Dec 10, 2025

Closes #115

Overview

Prior to this change, after building, dist/src/logger.d.ts in the built package contained:

import { getLogger as clientGetLogger } from 'livekit-client';
export type StructuredLogger = ReturnType<typeof clientGetLogger>;

/**
 * @internal
 */
export declare function getLogger(name: string): import("livekit-client/dist/src/logger").StructuredLogger;

After this change, dist/src/logger.d.ts in the built package contains:

import { getLogger as clientGetLogger } from 'livekit-client';
export type StructuredLogger = ReturnType<typeof clientGetLogger>;

/**
 * @internal
 */
export declare function getLogger(name: string): StructuredLogger;

Some notes:

The import() path that is being included in the output does actually exist in a demo project I set up locally, and should properly resolve (albeit logger would have to resolve to logger.d.ts and not logger.ts / logger.js). So I'm not exactly sure why the reporter is encountering this issue in the first place... maybe it's due to some angular tooling specific nuances I am unfamiliar with? Or maybe it's due to the explicit exports entries in livekit-client?

Also, I don't really love my solution here, given that the locally defined StructuredLogger is set to ReturnType<getLogger>, and this fix relies on that it seems like for implicit return types added in a .d.ts, import is left in while for an explicit ReturnType<...> typescript seems to be smart enough to traverse through that import and get the underlying type value. Ideally, there would be some tsconfig setitng that could be included at build time or something similar that could be used to control this (I took a look and couldn't find anything though).

Any ideas on how to do this in a more robust way would be appreciated!

@changeset-bot
Copy link

changeset-bot bot commented Dec 10, 2025

🦋 Changeset detected

Latest commit: 15d9b63

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@livekit/track-processors Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@lukasIO
Copy link
Contributor

lukasIO commented Dec 11, 2025

not entirely sure if this would fix the issue, but one thing to try would be explicit type paths for cjs/mjs like we do here

https://github.com/livekit/node-sdks/blob/081df95783da838ca998e8580c878e486359e540/packages/livekit-server-sdk/package.json#L16-L27

for general packaging support pnpx publint . after building the package locally helps identifying potential issues and has been super helpful

@1egoman 1egoman merged commit c269bf1 into main Dec 11, 2025
4 checks passed
@1egoman 1egoman deleted the fix-import-in-dts branch December 11, 2025 14:15
@github-actions github-actions bot mentioned this pull request Dec 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Type declarations import internal "livekit-client/dist/src/logger" causing TS build error (track-processors@0.7.0)

4 participants