1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
|
=== tests/cases/conformance/salsa/a.js ===
class B {
>B : B
constructor () {
this.n = 1
>this.n = 1 : 1
>this.n : number
>this : this
>n : number
>1 : 1
}
foo() {
>foo : () => void
}
}
class C extends B { }
>C : C
>B : B
// this override should be fine (even if it's a little odd)
C.prototype.foo = function() {
>C.prototype.foo = function() {} : () => void
>C.prototype.foo : () => void
>C.prototype : C
>C : typeof C
>prototype : C
>foo : () => void
>function() {} : () => void
}
class D extends B { }
>D : D
>B : B
D.prototype.foo = () => {
>D.prototype.foo = () => { this.n = 'not checked, so no error'} : () => void
>D.prototype.foo : () => void
>D.prototype : D
>D : typeof D
>prototype : D
>foo : () => void
>() => { this.n = 'not checked, so no error'} : () => void
this.n = 'not checked, so no error'
>this.n = 'not checked, so no error' : "not checked, so no error"
>this.n : any
>this : any
>n : any
>'not checked, so no error' : "not checked, so no error"
}
// post-class prototype assignments are trying to show that these properties are abstract
class Module {
>Module : Module
}
Module.prototype.identifier = undefined
>Module.prototype.identifier = undefined : undefined
>Module.prototype.identifier : any
>Module.prototype : Module
>Module : typeof Module
>prototype : Module
>identifier : any
>undefined : undefined
Module.prototype.size = null
>Module.prototype.size = null : null
>Module.prototype.size : any
>Module.prototype : Module
>Module : typeof Module
>prototype : Module
>size : any
>null : null
class NormalModule extends Module {
>NormalModule : NormalModule
>Module : Module
identifier() {
>identifier : () => string
return 'normal'
>'normal' : "normal"
}
size() {
>size : () => number
return 0
>0 : 0
}
}
|