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

Incorrect inferred return type for a function that returns a circular type referencing itself #11189

Closed
guncha opened this issue Sep 27, 2016 · 1 comment
Labels
Duplicate An existing issue was already created

Comments

@guncha
Copy link

guncha commented Sep 27, 2016

TypeScript Version: master at a633652 (Sep 27, 2016)

Code

interface Fun<T> {
  (value: T)
}

function switcheroo<T>(component: Fun<T>): Fun<T> {
  return component
}

function MyComponent(value: string) {
  return {
    type: OtherComponent
  }
}

export const OtherComponent = switcheroo(MyComponent)

Expected behavior:

Expected type of MyComponent to be (value: string) => {type: Fun<string>} and type of OtherComponent to be Fun<string>

Actual behavior:
Both types are any.

This is likely related or caused by the same thing as #5487 but I thought I'd contribute another test case.

@RyanCavanaugh RyanCavanaugh added the Duplicate An existing issue was already created label Sep 27, 2016
@RyanCavanaugh
Copy link
Member

RyanCavanaugh commented Sep 27, 2016

See #10978

@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