Skip to content

Diagnostics for costly type inference #13057

@pspeter3

Description

@pspeter3

TypeScript Version: 2.1.1 / nightly (2.2.0-dev.201xxxxx)

As described in http://stackoverflow.com/questions/36624273/investigating-long-typescript-compile-times, untyped generics can cause the TypeScript compiler to spend significantly more time type checking. It would be extremely useful to have the diagnostics report expensive type inference.

Code

This is copied from the StackOverflow example

// slow:
// ...
.flatMap((receivedObj: MyType) => {
    let nextObservable: Observable<MySecondType> = this.dependingPut(receivedObj);
    return nextObservable || new Observable((observer) => {
            observer.next(undefined);
        });
});


// fast:
.flatMap((receivedObj: MyType) => {
    let nextObservable: Observable<MySecondType> = this.dependingPut(receivedObj);  
    return nextObservable || new Observable<MySecondType>((observer) => { // <--- use the generics!
            observer.next(undefined);
        });
});

Expected behavior:

Display costly type inference when diagnostics mode is enabled. Running git bisect to find performance bottlenecks is prohibitively difficult with a significantly large code base.

Actual behavior:

Only time checking is reported when using the diagnostics flag.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs More InfoThe issue still hasn't been fully clarified

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions