Closed haines closed 1 week ago
Please share a reproduction code sandbox or repo. The types only matter for the ESM build which is used for the flat config, the commonjs export is only for legacy config files which don't need the types.
Hi @mskelton, here's a minimal repro: https://github.com/haines/eslint-plugin-playwright-types-are-wrong
Fixed in 4c61256978556570b4f528eb2ba932ebee110609 and faee198b68b1e134ed389b09c0b663011a556d9e
Thanks!
I get TypeScript errors when attempting to use this plugin. It seems like the types are wrong.
This has a type error (
Property 'configs' does not exist
) but works at runtime:This type-checks successfully but fails at runtime (
TypeError: undefined is not an object (evaluating 'playwrightPlugin.default.configs')
:My experience seems to be consistent with the issues reported by "Are The Types Wrong?"
https://arethetypeswrong.github.io/?p=eslint-plugin-playwright%402.0.0
❗️Incorrect default export
The resolved types use export default where the JavaScript file appears to use module.exports =. This will cause TypeScript under the node16 module mode to think an extra .default property access is required, but that will likely fail at runtime. These types should use export = instead of export default.
🎭 Masquerading as CJS
Import resolved to a CommonJS type declaration file, but an ESM JavaScript file.