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

Inference not working as expected #8772

Closed
sledorze opened this issue May 23, 2016 · 4 comments
Closed

Inference not working as expected #8772

sledorze opened this issue May 23, 2016 · 4 comments
Labels
Duplicate An existing issue was already created

Comments

@sledorze
Copy link

TypeScript Version: 1.9.0-dev.20160523-1.0

Code

// A self-contained demonstration of the problem follows...

class Foo {

  identity<T>(x: T): T {
    return x
  }

  compose<A, B, C>(f: (b: B) => C, g: (a: A) => B) : (a:A) => C {
    return (a: A) => f(g(a))
  }

  constructor()  {
    let value = this.compose((a : number) => a, this.identity)
  }
}

Expected behavior:

value should have type (a: number) => number
OR
it should issue an error as the tsconfig.json has "noImplicitAny" defined to true.

Actual behavior:

value has type (a: {}) => number
AND
no error from the compiler.

@mhegazy
Copy link
Contributor

mhegazy commented May 23, 2016

duplicate of #5254

@mhegazy mhegazy added the Duplicate An existing issue was already created label May 23, 2016
@mhegazy mhegazy closed this as completed Jun 7, 2016
@sledorze
Copy link
Author

sledorze commented Jun 8, 2016

@mhegazy why has it been closed? I see that the duplicate issue is still open..

@mhegazy
Copy link
Contributor

mhegazy commented Jun 8, 2016

why has it been closed? I see that the duplicate issue is still open..

We like to keep on report to track an issue. no need to have multiple open reports. Duplicate reports are closed with a link to the main report.

@sledorze
Copy link
Author

sledorze commented Jun 9, 2016

thanks @mhegazy for the clarification, I understand your need to reduce the 'noise' :)

@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
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

2 participants