Skip to content

Are types available in a flat namespace? #8

@samuelgoto

Description

@samuelgoto

(porting @Waldemar's comments into github issues)

@Waldemar: on scoping, are types available in a flat namespace? For example:

function a() { 
  class B { foo() { console.log("bar"); } }; 
  var b = new B(); 
  b.foo();
}

class B {    
}

var c:B = new B();
// NOTE(waldemar): which B does c refer to from a type-checking perspective?
// NOTE(goto, dimvar): types follows the interpreter scoping rules. For example, 
// the typechecker complains on the following line that "property foo()" does not
// exist on type "B".
c.foo(); // Error

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions