This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Base | |
{ | |
first = { v: 1 }; | |
second = this.first; | |
} | |
class Derived extends Base | |
{ | |
first = { v: 2 }; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Base | |
{ | |
first = { v: 1 }; | |
second = () => this.first; | |
} | |
class Derived extends Base | |
{ | |
first = { v: 2 }; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class VirtHandler | |
{ | |
target: any; | |
get( t: any, p: PropertyKey, r: any): any | |
{ | |
return this.target[p]; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function virtual( target: any, name: string) | |
{ | |
// symbol to keep the proxy handler value | |
let sym = Symbol( name + "_proxy_handler"); | |
Object.defineProperty( target, name, { | |
enumerable: true, | |
get() | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Base | |
{ | |
@virtual a = 1; | |
b = this.a; | |
} | |
class Derived extends Base | |
{ | |
a = 2; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// @virtual decorator function | |
function virtual( target: any, name: string) | |
{ | |
// symbol to keep the proxy handler value | |
let sym = Symbol( name + "_proxy_handler"); | |
Object.defineProperty( target, name, { | |
enumerable: true, | |
get() |