Skip to content

Discussion about typeof navigation #19441

Closed
@Alphapage

Description

@Alphapage

TypeScript Version: 2.5.3

Code

class C {
    constructor(s:string){}
    test(){}
}

const o={C:C}

let c:typeof o.C.prototype

let c2:C=new C('');

let c3:(typeof o).C;

Expected behavior:
(typeof o).C in c3 produces an error.
For now, typeof can navigate to variable and properties only, not types.
It would be great to be able to continue navigate types after a variable casting. So, (typeof o).C and typeof o.C.prototype will produce the same type result.
I prefer (typeof o).C of course.
Actual behavior:
let c3:(typeof o).C; hates parenthesis

Metadata

Metadata

Assignees

No one assigned

    Labels

    QuestionAn issue which isn't directly actionable in code

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions