slorber / awesome-debounce-promise

Debounce your API calls easily and stay in promised land.
https://sebastienlorber.com
391 stars 9 forks source link

Errors in webpack: A rest parameter must be of an array type| has no default export. #10

Closed rvsia closed 5 years ago

rvsia commented 5 years ago

Hello,

we would like to use this library in our project, however Webpack shows errors after building.

ERROR in [at-loader] ./node_modules/@types/debounce-promise/index.d.ts:14:36 
    TS2370: A rest parameter must be of an array type.

ERROR in [at-loader] ./node_modules/@types/debounce-promise/index.d.ts:21:5 
    TS2370: A rest parameter must be of an array type.

ERROR in [at-loader] ./node_modules/awesome-debounce-promise/dist/index.d.ts:1:8 
    TS1192: Module '"/home/rvsianskz/miq/manageiq-ui-classic/node_modules/@types/debounce-promise/index"' has no default export.
slorber commented 5 years ago

Hi,

I'm not a TS expert yet so any help would be helpful

This library depends on another library and it seems TS has troubles understanding the types (community def) of the dependency lib: https://github.com/bjoerge/debounce-promise

Are you on latest TS version? Not sure it'll work with 2.x

Also I think you should have "allowSyntheticDefaultImports": true option in tsconfig.

If you can provide a reproduction repo that would be helpful

rvsia commented 5 years ago

Repo: https://github.com/ManageIQ/manageiq-ui-classic/ (or you can look at the PR where I referenced this issue.)

There is "typescript": "~2.8.1".

slorber commented 5 years ago

Thanks.

I'm not sure but I don't think it will work with TS < 3.x

Don't know enough TS yet to be sure but I think the types are using quite modern TS features

rvsia commented 5 years ago

Thanks! I will check what I can do with that. (I know nothing about TS. 😣 😄 )

rvsia commented 5 years ago

@slorber Yeah, updating to the latest typescript and adding the option to the config helped!

Thank you! And great job with the library!

slorber commented 5 years ago

Awesome thanks for the feedback