Skip to content
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

type information tooltips stopped making sense #10337

Closed
zpdDG4gta8XKpMCd opened this issue Aug 15, 2016 · 7 comments
Closed

type information tooltips stopped making sense #10337

zpdDG4gta8XKpMCd opened this issue Aug 15, 2016 · 7 comments
Assignees
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue

Comments

@zpdDG4gta8XKpMCd
Copy link

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

@RyanCavanaugh RyanCavanaugh added the Needs More Info The issue still hasn't been fully clarified label Aug 15, 2016
@RyanCavanaugh
Copy link
Member

What's a standalone repro of this?

@zpdDG4gta8XKpMCd
Copy link
Author

zpdDG4gta8XKpMCd commented Aug 15, 2016

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>

@RyanCavanaugh RyanCavanaugh added Bug A bug in TypeScript and removed Needs More Info The issue still hasn't been fully clarified labels Aug 15, 2016
@RyanCavanaugh RyanCavanaugh added this to the TypeScript 2.1 milestone Aug 15, 2016
@RyanCavanaugh
Copy link
Member

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);

@zpdDG4gta8XKpMCd
Copy link
Author

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)

@OliverJAsh
Copy link
Contributor

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

@OliverJAsh
Copy link
Contributor

Simple test case: #10793 (comment)

@mhegazy mhegazy assigned yuit and unassigned sandersn Sep 29, 2016
@mhegazy
Copy link
Contributor

mhegazy commented Oct 24, 2016

This looks fixed in latest.

@mhegazy mhegazy closed this as completed Oct 24, 2016
@mhegazy mhegazy added the Fixed A PR has been merged for this issue label Oct 24, 2016
@ahejlsberg ahejlsberg assigned ahejlsberg and unassigned yuit Nov 6, 2016
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue
Projects
None yet
Development

No branches or pull requests

7 participants