Skip to content

robbiecren07/lighthouse-ts-error

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lighthouse TypeScript Error Reproduction

This repo demonstrates a TypeScript build error caused by importing the internal Lighthouse config:

import mobileConfig from 'lighthouse/core/config/lr-mobile-config.js'

❌ The Problem

When you run tsc, TypeScript throws the following error:

node_modules/lighthouse/core/config/lr-mobile-config.d.ts:8:23 - error TS2503: Cannot find namespace 'LH'.

8 declare const config: LH.Config;

✅ Reproduction Steps

Clone the repo:

git clone https://github.com/your-username/lighthouse-ts-error.git
cd lighthouse-ts-error

Install dependencies:

npm install

Run the build:

npm run build

You should see the TS2503 error coming from lr-mobile-config.d.ts.

🔍 Root Cause

The file lighthouse/core/config/lr-mobile-config.d.ts contains:

declare const config: LH.Config;

…but LH is not declared in the file, nor is the global type included via:

/// <reference types="lighthouse/types/global-lh" />

This breaks TypeScript builds unless you:

  • Add that reference manually, or
  • Set skipLibCheck: true, or
  • Avoid importing internal Lighthouse files

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors