react-top-loading-bar icon indicating copy to clipboard operation
react-top-loading-bar copied to clipboard

Wrong TS typings for LoadingBarRef's continuousStart method

Open Thanaen opened this issue 3 years ago • 1 comments

Repro: https://codesandbox.io/s/react-top-loading-bar-typing-kxsdn

It seems that the continuousStart typings have recently been updated. The method now requires two mandatory paramters "startingValue" and "refreshRate". The method's type is currently:

((startingValue: number, refreshRate: number) => void) | undefined

Shouldn't it be:

((startingValue?: number, refreshRate?: number) => void) | undefined

?

Thanaen avatar Dec 01 '21 08:12 Thanaen

Yes, kind of … at least that's what the docs say (both params optional).

But since the method signature is continuousStart(startingValue: number, refreshRate: number = 1000) this should be changed to continuousStart(startingValue?: number, refreshRate: number = 1000) to make method and type match.

https://github.com/klendi/react-top-loading-bar/blob/master/src/index.tsx#L113

baumerdev avatar Dec 30 '21 15:12 baumerdev