Skip to content

Interfaces can't extend typeof types #14757

Closed
@dempfi

Description

@dempfi

TypeScript Version: 2.2.1 / nightly (2.2.0-dev.201xxxxx)

Code

// This doesn't work
const a = {
  b: 'some string'
}
interface X extends typeof a {
  a: number
}

// This does
const a = {
  b: 'some string'
}
type A = typeof a
interface X extends A {
  a: number
}

Expected behavior:
Treat typeof expression as type expression in type definition context.

Actual behavior:
Compiler throws an Expression expected. error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Working as IntendedThe behavior described is the intended behavior; this is not a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions