pqina / filepond

🌊 A flexible and fun JavaScript file upload library
https://pqina.nl/filepond
MIT License
15.18k stars 828 forks source link

Fix typings #963

Open Akiyamka opened 8 months ago

Akiyamka commented 8 months ago

fix: not all events listed in FilePondsEvents fix: .on method of filedpond instance not inherit callback arguments types fix: manual prefixing replaced with generated

Before:

pond.on('processfileprogress', (file, progress) => {
   // file: any
   // progress: any
})

After:

pond.on('processfileprogress', (file, progress) => {
   // file: FilePond.FilePondFile
   // progress: number
})

Fixes #962

rikschennink commented 8 months ago

I'm comfortable with adding events and adding missing types, but the generated types I'd rather avoid for now.

Akiyamka commented 8 months ago

I can remove the generation for FilePondEventPrefixed, but elsewhere I have been unable to get typescript to properly inherit the callback argument type without generics.

rikschennink commented 8 months ago

Im unfortunately not experienced enough to comment on this. I normally just describe each property/method/event separately and want to keep things in a state where I still know what’s going on.