danielearwicker / doop

Succint immutable record classes for TypeScript
MIT License
12 stars 0 forks source link

Static members holding instance of enclosing doop class are broken #5

Open danielearwicker opened 8 years ago

danielearwicker commented 8 years ago

static member, type of enclosing class, e.g.

@doop
class C {

    static S = new C();

    @doop
    get something() {
        return field<number, this>();
    }
}

The doop decorator runs after the static field S is initialised. So S refers to an instance of the class created before decoration has happened, and is therefore effectively "corrupted".

danielearwicker commented 8 years ago

See Microsoft/TypeScript#9868