Closed
Description
TypeScript Version: 3.9.5
Search Terms:
performance
Code
export declare type ThenArg<T> = T extends any ? any : T extends PromiseLike<infer U> ? U : T;
export interface InterfaceA<T> {
filter(callback: (newValue: T, oldValue: T) => boolean): InterfaceA<T>;
map<D>(callback: (value: T) => D): InterfaceA<D>;
await<R extends ThenArg<T>>(): InterfaceA<R>;
awaitLatest<R extends ThenArg<T>>(): InterfaceA<R>;
awaitOrdered<R extends ThenArg<T>>(): InterfaceA<R>;
}
export interface InterfaceB<T> extends InterfaceA<T> {
map<D>(callback: (value: T) => D): InterfaceB<D>;
await<R extends ThenArg<T>>(): InterfaceB<R>;
awaitLatest<R extends ThenArg<T>>(): InterfaceB<R>;
awaitOrdered<R extends ThenArg<T>>(): InterfaceB<R>;
}
export class A<T> implements InterfaceB<T> {
public filter(callback: (newValue: T, oldValue: T) => boolean): B<T> {
return undefined;
}
public map<D>(callback: (value: T) => D): B<D> {
return undefined;
}
public await<R extends ThenArg<T>>(): B<R> {
return undefined;
}
public awaitOrdered<R extends ThenArg<T>>(): B<R> {
return undefined;
}
public awaitLatest<R extends ThenArg<T>>(): B<R> {
return undefined;
}
}
export class B<T> extends A<T> {}
Expected behavior:
Does not slow down typescript to a crawl
Actual behavior:
Takes 8 seconds to build on its own, makes every single vscode interaction with typescript slow down to a crawl
Hello guys, while I was coding I found that for some reason typescript massively dropped in performance in my project, I isolated the issue to the example above
I also found that doing minor changes e.g. making interfaceB not extend interfaceA but instead make A implement both fixes the issue completely. So this particular way of defining my interfaces seems to trigger a bad code path in typescript.
I've tried different typescript versions including the newest one they all seem to have this issue