Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export Typescript types declaration #232

Open
Kapcash opened this issue Oct 10, 2024 · 2 comments
Open

Export Typescript types declaration #232

Kapcash opened this issue Oct 10, 2024 · 2 comments

Comments

@Kapcash
Copy link

Kapcash commented Oct 10, 2024

This plugin, when imported from a .ts file, throws types error because it doesn't declare any types.

I think it would be a good enhancement to declare at single a single types.d.ts in the package to export types, without converting the whole source code to Typescript.
This way, Typescript users can seamlessly import the package without having to declare themselves the types :)

You can even export declaration types from .js files! https://www.typescriptlang.org/docs/handbook/declaration-files/dts-from-js.html

@Kapcash
Copy link
Author

Kapcash commented Oct 10, 2024

Here is my own, primitive, declaration file for this package:

packages.d.ts
declare module 'eslint-plugin-cypress/flat' {
  import type { ESLint } from 'eslint';
  const plugin: ESLint.Plugin;

  export default plugin;
};

@MikeMcC399
Copy link
Collaborator

@Kapcash

Thank you for raising this issue!

According to the ESLint v9 documentation TypeScript Configuration Files

This feature is currently experimental and may change in future versions.

Please check the above documentation link and see if it is helpful for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants