Skip to content

fix(types): move @types/debug from devDependencies to dependencies#290

Merged
danstepanov merged 1 commit intonativewind:mainfrom
YevheniiKotyrlo:fix/move-types-debug-to-dependencies
Mar 9, 2026
Merged

fix(types): move @types/debug from devDependencies to dependencies#290
danstepanov merged 1 commit intonativewind:mainfrom
YevheniiKotyrlo:fix/move-types-debug-to-dependencies

Conversation

@YevheniiKotyrlo
Copy link
Contributor

Summary

compiler.types.ts exports the Debugger type from "debug" in the public CompilerOptions.logger type:

// src/compiler/compiler.types.ts
import type { Debugger } from "debug";

export interface CompilerOptions {
  logger?: (message: string) => void | Debugger;
}

This type is re-exported from the ./compiler entry point and published in the .d.ts files under dist/typescript/. However, @types/debug is listed in devDependencies, so it's not installed for consumers. The debug package itself ships no type declarations.

Consumers with skipLibCheck: false get:

error TS7016: Could not find a declaration file for module 'debug'.

This affects all NativeWind users because nativewind/metro imports react-native-css/metro, which transitively imports the compiler module:

metro.config.ts
  → nativewind/metro
    → react-native-css/metro
      → react-native-css/compiler
        → compiler.types.d.ts: import type { Debugger } from "debug"

Fix

Move @types/debug from devDependencies to dependencies. debug is already a runtime dependency — its type declarations should follow.

Test plan

  • yarn typecheck — pass
  • yarn lint — pass
  • yarn build — pass (module + commonjs + typescript)
  • yarn test — 969 passed, 3 pre-existing failures in babel plugin tests (unrelated)
  • No unstaged files after build
  • Verified in isolated consumer project: error reproduces without @types/debug, resolves with it installed

@YevheniiKotyrlo YevheniiKotyrlo force-pushed the fix/move-types-debug-to-dependencies branch from 3153651 to 6683bdb Compare March 4, 2026 18:37
@danstepanov danstepanov self-requested a review March 9, 2026 07:06
Copy link
Member

@danstepanov danstepanov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Straightforward fix, makes sense. @types/debug is exposed in the public API via CompilerOptions.logger, so it belongs in dependencies.

Future thought
The Debugger type leaking into the public surface is what caused this in the first place. It might be worth narrowing logger to just (message: string) => void and keeping @types/debug internal but that's a separate conversation. This is fine for now.

@danstepanov danstepanov merged commit 43787dc into nativewind:main Mar 9, 2026
6 checks passed
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.

2 participants