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

Type declarations are not extracted properly in published package #1392

Closed
rostislav-simonik opened this issue Dec 1, 2024 · 2 comments
Closed

Comments

@rostislav-simonik
Copy link

Describe the bug

Depsite generic type in index.ts is declared properly

export class FSWatcher extends EventEmitter<FSWatcherEventMap> {

extracted types in index.ts (both esm, cjs) in a published package having the following declaration

export declare class FSWatcher extends EventEmitter {

ending up with any type inferred for event handlers

watch('src').on('all', (event, path) => { debounceSrc(path) })

// Unsafe argument of type `any` assigned to a parameter of type `string`.eslint[@typescript-eslint/no-unsafe-argument](https://typescript-eslint.io/rules/no-unsafe-argument)
(parameter) path: any

Versions (please complete the following information):

  • Chokidar version 4.0.1
  • Node version 20.17.0
  • OS version: MacOS Sonoma

To Reproduce:

Self explanatory, but can provide it later if needed

Most valuable could be one or more test cases for test.js to demonstrate the problem.

Expected behavior
The published package should have a type declaration with a generic type

export declare class FSWatcher extends EventEmitter<FSWatcherEventMap> {

Additional context
Add any other context about the problem here.
Optionally nice to know what project you are working on.

@paulmillr
Copy link
Owner

pull requests welcome

@43081j
Copy link
Collaborator

43081j commented Dec 1, 2024

@paulmillr he's just too soon

the PR to add those strongly typed events hasn't been released yet

it is in main but we haven't published a new version of chokidar yet, so it won't be on npm

if you can publish a new version, that'd be helpful

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

No branches or pull requests

3 participants