sindresorhus / p-queue

Promise queue with concurrency control
MIT License
3.45k stars 185 forks source link

Property '_doesIntervalAllowAnother' implicitly has type 'any' #89

Closed ChristianBoehlke closed 3 years ago

ChristianBoehlke commented 4 years ago

Hello,

Thank you for the great work with this library! We tried upgrading from version 6.2.0 to 6.2.1 and are getting the following TypeScript compiler errors:

node_modules/p-queue/dist/index.d.ts:28:17 - error TS7033: Property '_doesIntervalAllowAnother' implicitly has type 'any', because its get accessor lacks a return type annotation.

28     private get _doesIntervalAllowAnother();
                   ~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/p-queue/dist/index.d.ts:29:17 - error TS7033: Property '_doesConcurrentAllowAnother' implicitly has type 'any', because its get accessor lacks a return type annotation.

29     private get _doesConcurrentAllowAnother();
                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~

We are using TypeScript 3.6.4 and have noImplicitAny: true set.

The type definitions for version 6.2.0 declared them as private variables:

private readonly _doesIntervalAllowAnother;
private readonly _doesConcurrentAllowAnother;

The type definitions for version 6.2.1 now declare them as private getters:

private get _doesIntervalAllowAnother();
private get _doesConcurrentAllowAnother();

Maybe that's why TypeScript treats them differently?

Thank you for you help!

sindresorhus commented 4 years ago

Looks like it was fixed in TS 3.7.2, but I think you have to upgrade to that version: https://github.com/microsoft/TypeScript/commit/e48cd3a1011ba0b61edee0cc19201cff8ff6f6e6

georgyfarniev commented 4 years ago

@sindresorhus I cannot upgrade to latest typescript, since it will break many things in my monorepo (nuxt, vue, etc have some issues). How about adding explicit type annotations please?

sindresorhus commented 4 years ago

It does have a type annotation: https://github.com/sindresorhus/p-queue/blob/c2e768f540dd22380bdf84c8cbd5a794ccac5e02/source/index.ts#L91 The problem is explained in the linked commit. Not much I can do to work around it. I suggest you just pin the p-queue version to 6.2.0 until you can upgrade TypeScript.

sindresorhus commented 4 years ago

More discussion about it here: https://github.com/microsoft/TypeScript/issues/35016