Skip to content

in type signatures, cannot refer to class defined as static anonymous class #7421

Closed
@kenhahn85

Description

@kenhahn85

TypeScript Version:

nightly (1.9.0-dev.20160307)

Code

// A self-contained demonstration of the problem follows...
export abstract class CaseClass {
  constructor(...args: any[]) {}
}

abstract class TestCaseClass extends CaseClass {
  static A = <typeof CaseClass> class extends TestCaseClass {
    v: number;
    constructor(v: number) {
      super();
      this.v = v;
    }
  };
  static B = <typeof CaseClass> class extends TestCaseClass {
    v: string;
    constructor(v: string) {
      super();
      this.v = v;
    }
  };
}

function test(v: TestCaseClass.A) {
  return v.v;
}

Expected behavior:
I would expect this to compile.

Actual behavior:
A failure in the compilation of test:

error TS2503: Cannot find namespace \'TestCaseClass\'.

Metadata

Metadata

Assignees

No one assigned

    Labels

    DeclinedThe issue was declined as something which matches the TypeScript visionSuggestionAn idea for TypeScript

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions