lr-mobile-config.d.ts breaks TS builds: Cannot find namespace 'LH' · Issue #16503 · GoogleChrome/lighthouse · GitHub | Latest TMZ Celebrity News & Gossip | Watch TMZ Live
Skip to content

lr-mobile-config.d.ts breaks TS builds: Cannot find namespace 'LH' #16503

Open
@robbiecren07

Description

@robbiecren07

FAQ

URL

https://github.com/robbiecren07/lighthouse-ts-error

What happened?

When importing lighthouse/core/config/lr-mobile-config.js, TypeScript throws:
TS2503: Cannot find namespace 'LH'

The issue is that lr-mobile-config.d.ts references LH.Config, but does not include a reference to the LH types (e.g., /// ).

This makes it impossible to import lr-mobile-config.js in a TypeScript project without manually patching or disabling type checks (skipLibCheck).

Proposed fix: Add this to the top of the .d.ts file:
/// <reference types="lighthouse/types/global-lh" />

Or at least document that users must do this in their own tsconfig.json.

What did you expect?

I expected to be able to import the provided Lighthouse mobile config (lighthouse/core/config/lr-mobile-config.js) in a TypeScript project without TypeScript throwing a type error.

Specifically, I expected the corresponding lr-mobile-config.d.ts file to be valid and self-contained, or to properly reference the required LH namespace, so that tsc could compile without needing extra configuration or manual type patching.

What have you tried?

I verified that the error is coming from lr-mobile-config.d.ts, which references the LH namespace without declaring or importing it. I attempted to resolve the issue by:

Adding /// <reference types="lighthouse/types/global-lh" /> manually in my own tsconfig.json and a custom global.d.ts file.

Setting "skipLibCheck": true in tsconfig.json to bypass the error.

Avoiding the import entirely and inlining the config as a workaround.

These workarounds avoid the error, but the type definition should ideally be self-contained or include the required reference internally.

How were you running Lighthouse?

node

Lighthouse Version

12.6.0

Chrome Version

No response

Node Version

20.17.0

OS

No response

Relevant log output

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      TMZ Celebrity News – Breaking Stories, Videos & Gossip

      Looking for the latest TMZ celebrity news? You've come to the right place. From shocking Hollywood scandals to exclusive videos, TMZ delivers it all in real time.

      Whether it’s a red carpet slip-up, a viral paparazzi moment, or a legal drama involving your favorite stars, TMZ news is always first to break the story. Stay in the loop with daily updates, insider tips, and jaw-dropping photos.

      🎥 Watch TMZ Live

      TMZ Live brings you daily celebrity news and interviews straight from the TMZ newsroom. Don’t miss a beat—watch now and see what’s trending in Hollywood.