Typescript: type information tooltips stopped making sense

Created on 15 Aug 2016  路  7Comments  路  Source: microsoft/TypeScript

interface Promised<a> {
   then<b>(toValue: (value: a) => b): Promised<b>;
   then<b>(toValue: (value: a) => Promsied<b>): Promised<b>;
}

declare function willPollAsLongAsUntil<a, r>(
    beDisposed: any,
    interval: number,
    state: a,
    check: (state: a) => eh.Either<a, r>
): Promised<r>; // <-- notice that Promised has a SINGLE type parameter

image

despite having a single type parameter Promised interface is shown with 2 type parameters in the tooltip

Bug Fixed

Most helpful comment

2.0 RC is out, would this bug be a part of the 2.0 release? it's rather big annoying and very visible, 2.1 milestone looks like a typo (should be 2.0.1 imho)

All 7 comments

What's a standalone repro of this?

latest build

sorry, don't have time to narrow it to the core

export type Promised<a> = Resolved<a> | Unresolved<a>;

export interface Chainable<a> {
    then<b>(map: (value: a) => b | Promised<b>): Promised<b>;
}

export interface Resolved<a> extends Chainable<a> {
    value: a;
}

export interface Unresolved<a> extends Chainable<a> {
    thens: {
        (value: a): void;
    }[];
}

interface Left<a> {
    left: a;
}
function leftFrom<a>(value: a): Left<a> {
    return { left: value };
}

interface Right<a> {
    right: a;
}
function rightFrom<a>(value: a): Right<a> {
    return { right: value };
}

type Either<a, b> = Left<a> | Right<b>

declare function willPollAsLongAsUntil<a, r>(
    state: a,
    check: (state: a) => Either<a, r>
): Promised<r>;

const tried = willPollAsLongAsUntil(0, count => count < 100
? leftFrom(count + 1)
: rightFrom('stop')) // Promised<number, string>

image

interface Generic1<T> { x: T };
interface Generic2<T> { y: T };
type Promised<a> = Generic1<a> | Generic2<a>;

declare function f<x, y>(a: x, b: y): Promised<x>;

/**/f('', 3);

2.0 RC is out, would this bug be a part of the 2.0 release? it's rather big annoying and very visible, 2.1 milestone looks like a typo (should be 2.0.1 imho)

This makes reading types very hard 馃槖 Can we get a fix for this soon?

This looks fixed in latest.

Was this page helpful?
0 / 5 - 0 ratings