cypress-io / cypress

Fast, easy and reliable testing for anything that runs in a browser.
https://cypress.io
MIT License
47.02k stars 3.18k forks source link

@cypress/webpack-batteries-included-preprocessor doesn't include types #25997

Open karlhorky opened 1 year ago

karlhorky commented 1 year ago

Current behavior

  1. ✅ The webpack preprocessor @cypress/webpack-preprocessor includes TypeScript types
  2. ❌ The webpack preprocessor @cypress/webpack-batteries-included-preprocessor does not include TypeScript types

This means that imports of @cypress/webpack-batteries-included-preprocessor fail type checking:

cypress.config.ts

import webpackPreprocessor from '@cypress/webpack-batteries-included-preprocessor'; // ❌ Could not find a declaration file for module '@cypress/webpack-batteries-included-preprocessor'

Full error message:

Could not find a declaration file for module '@cypress/webpack-batteries-included-preprocessor'. '/Users/k/p/project/node_modules/@cypress/webpack-batteries-included-preprocessor/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/cypress__webpack-batteries-included-preprocessor` if it exists or add a new declaration (.d.ts) file containing `declare module '@cypress/webpack-batteries-included-preprocessor';`ts(7016)
Screenshot 2023-03-02 at 13 45 26

The package @types/cypress__webpack-batteries-included-preprocessor also does not exist in DefinitelyTyped.

Desired behavior

@cypress/webpack-batteries-included-preprocessor should have types

Test code to reproduce

cypress.config.ts

import webpackPreprocessor from '@cypress/webpack-batteries-included-preprocessor'; // ❌ Could not find a declaration file for module '@cypress/webpack-batteries-included-preprocessor'

Cypress Version

12.6.0

Node version

18.14.1

Operating System

macOS Ventura 13.2.1 (22D68)

Debug Logs

No response

Other

No response

karlhorky commented 1 year ago

Oh I guess even a bigger problem: it is still on webpack 4 😱