TypeScript/tests/cases/compiler/thisInClassBodyStaticESNext.ts
Nathan Shively-Sanders af901ba911
No error on this exprs in static property inits (#36781)
No error on `this` expressions in static property declaration
initialisers when targetting ESNext and with useDefineForClassFields. In
this case the emit is correct and the types are correct, so the error
should not be issued.
2020-02-26 09:07:45 -08:00

12 lines
258 B
TypeScript

// @target: esnext
// @useDefineForClassFields: true
// all are allowed with es-compliant class field emit
class Foo {
x = this
static t = this
static at = () => this
static ft = function () { return this }
static mt() { return this }
}