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

Bug for this-type in literal object type #6315

Closed
andy-hanson opened this issue Jan 2, 2016 · 1 comment
Closed

Bug for this-type in literal object type #6315

andy-hanson opened this issue Jan 2, 2016 · 1 comment
Labels
By Design Deprecated - use "Working as Intended" or "Design Limitation" instead

Comments

@andy-hanson
Copy link

This code causes an error:

type X<A> = {x: A}

interface Foo {
    // works
    a(): X<this>
    // does not work
    b(): {x: this}
}

Output:

foo.ts(7,11): error TS2526: A 'this' type is available only in a non-static member of a class or interface.

It errors if the object type is defined inline, but works for a typedef.

@ahejlsberg
Copy link
Member

This is by design. See discussion here.

@ahejlsberg ahejlsberg added the By Design Deprecated - use "Working as Intended" or "Design Limitation" instead label Jan 2, 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
By Design Deprecated - use "Working as Intended" or "Design Limitation" instead
Projects
None yet
Development

No branches or pull requests

3 participants