Overview of Are the Types Wrong?
mainAre the Types Wrong is a tool designed to analyze npm packages for TypeScript type issues, specifically focusing on ESM-related module resolution problems. It detects issues across node10, node16, and bundler module resolution modes.
Key problems detected include:
- Resolution failed: The module cannot be resolved.
- No types: The resolution succeeds but no type definitions are found.
- Masquerading as CJS/ESM: The package claims to be one module type but behaves like another.
- ESM (dynamic import only): The package can only be loaded via dynamic import.
- Used fallback condition: The package relies on problematic
exportsfallback conditions. - CJS default export issues: Problems with how default exports are handled in CommonJS.
- Incorrect/False default exports: Mismatches in how default exports are declared vs. how they behave.
- Missing
export =: Missing the standard CommonJS export pattern. - Unexpected module syntax: Syntax that violates the expected module type.
- Internal resolution error: Errors occurring during the internal resolution process.
- Named exports: Issues specifically related to named export availability.