-
Notifications
You must be signed in to change notification settings - Fork 30.4k
[@types/bluebird] v3.5.21 exhausts the tsc compiler #26964
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@onury The only difference between 3.5.20 and 3.5.21 is the addtion of this single line by @andnp: diff --git a/bluebird-3.5.20/index.d.ts b/bluebird-3.5.21/index.d.ts
index 8ad5705..1e49e04 100644
--- a/bluebird-3.5.20/index.d.ts
+++ b/bluebird-3.5.21/index.d.ts
@@ -542,6 +542,7 @@ declare class Bluebird<R> implements PromiseLike<R>, Bluebird.Inspection<R> {
* The new function will always return a promise that is fulfilled with the original functions return values or rejected with thrown exceptions from the orig
* This method is convenient when a function can sometimes return synchronously or throw synchronously.
*/
+ static method<R>(fn: () => R | PromiseLike<R>): () => Bluebird<R>;
static method<R, A1>(fn: (arg1: A1) => R | PromiseLike<R>): (arg1: A1) => Bluebird<R>;
static method<R, A1, A2>(fn: (arg1: A1, arg2: A2) => R | PromiseLike<R>): (arg1: A1, arg2: A2) => Bluebird<R>;
static method<R, A1, A2, A3>(fn: (arg1: A1, arg2: A2, arg3: A3) => R | PromiseLike<R>): (arg1: A1, arg2: A2, arg3: A3) => Bluebird<R>; I personally don't see how this can cause such a slowdown. Do you or @andnp got any idea maybe? Are you using the |
In general, having function overloads can add some cost to the TS compiler. However, my primary codebase uses My guess is that somehow adding this overload has caused some other tangential issue with your types, especially if you have any not type-checked JS in your project. For instance: // file1.ts
export const func = Bluebird.method(() => 22); // file2.js
import { func } from './file1';
func().then(console.log); This would have been a type error before, but if you have Even worse if this occurred in the middle of a large project that passes that inferred type around, then adding this overload may have opened the floodgates a bit. With a little more information on how you are using
|
@lhecker, @andnp that's strange. This happened in a huge code base with 5 linked projects. We don't use Before the slow-down happened; the only change we made initially was refactoring projects to use sub-types within sub-types. e.g. Then we realized we don't make use of any Bluebird-specific feature so we just removed Bluebird dependency from the project all together; in favor of native @andnp we don't have any plain JS in the code. |
Good to hear that there isn't any JS, that certainly makes things a bit easier. Perhaps I wasn't clear in my discussion on type X = // big expensive type
function identity(x: T): T { return x; }
function doThing(x) { // `x` here is implictly `any`
// do some stuff with x here
return x;
}
let x: X;
const y = doThing(x); // y is `any` implicitly. then some gung-ho programmer comes in and adds typings to function doThing(x: X) {
// still does stuff
return x;
}
const y = doThing(x); // y is `big expensive type` Although I brought this up in case I was the gung-ho programmer who made a tiny (seemingly harmless) change that opened these so-called floodgates by adding a new type to Now that you've moved away from If not: welcome future user, you've come to the right place to debug this issue ;) |
@andnp Thanks for your detailed reply. We're now using native Promise in these projects but still using Bluebird in some others :) I said I'm sure Thanks anyway. Let's see if others experience this issue. |
Hi thread, we're moving DefinitelyTyped to use GitHub Discussions for conversations the To help with the transition, we're closing all issues which haven't had activity in the last 6 months, which includes this issue. If you think closing this issue is a mistake, please pop into the TypeScript Community Discord and mention the issue in the |
Uh oh!
There was an error while loading. Please reload this page.
@types/bluebird
package and had problems.Definitions by:
inindex.d.ts
) so they can respond.Latest bluebird types exhaust the tsc compiler.
node_modules/@types
directory and it was bluebird definitely.The text was updated successfully, but these errors were encountered: