plugin-retry.js icon indicating copy to clipboard operation
plugin-retry.js copied to clipboard

Remove ts-ignores annotations

Open copperwall opened this issue 5 years ago • 14 comments

This removes existing ts-ignore annotations from plugin-retry.js. I did my best to use existing types from @octokit/types and @octokit/core instead of creating new types or interfaces in this project.

I did have some trouble getting rid of the type errors in wrap_request.ts on the bottleneck/light import. The bottleneck package does specify typings, but it looks like by using the light import, TypeScript can't relate those types to the exports from bottleneck/light.

I also tried placing

import type Bottlneck from 'bottleneck'
declare module "bottleneck/light" {
   export default Bottleneck
}

in a local bottleneck.d.ts file to import the Bottleneck namespace from the module and export it under the bottleneck/light module to appease TypeScript, but I got an error about how those types couldn't be applied to bottleneck/light import. The only thing that seemed to work was copying the type definitions into the library.

I'm open to looking for more solutions other than copying 1000+ lines of another modules types into this one, but this is the solution I've found so far.

Closes #43

copperwall avatar Jul 04 '20 02:07 copperwall