mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Adds support for new.target
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
// @target: es5
|
||||
const a = new.target;
|
||||
const b = () => new.target;
|
||||
|
||||
class C {
|
||||
[new.target]() { }
|
||||
c() { return new.target; }
|
||||
get d() { return new.target; }
|
||||
set e(_) { _ = new.target; }
|
||||
f = () => new.target;
|
||||
|
||||
static [new.target]() { }
|
||||
static g() { return new.target; }
|
||||
static get h() { return new.target; }
|
||||
static set i(_) { _ = new.target; }
|
||||
static j = () => new.target;
|
||||
}
|
||||
|
||||
const O = {
|
||||
[new.target]: undefined,
|
||||
k() { return new.target; },
|
||||
get l() { return new.target; },
|
||||
set m(_) { _ = new.target; },
|
||||
n: new.target,
|
||||
};
|
||||
@@ -0,0 +1,25 @@
|
||||
// @target: es6
|
||||
const a = new.target;
|
||||
const b = () => new.target;
|
||||
|
||||
class C {
|
||||
[new.target]() { }
|
||||
c() { return new.target; }
|
||||
get d() { return new.target; }
|
||||
set e(_) { _ = new.target; }
|
||||
f = () => new.target;
|
||||
|
||||
static [new.target]() { }
|
||||
static g() { return new.target; }
|
||||
static get h() { return new.target; }
|
||||
static set i(_) { _ = new.target; }
|
||||
static j = () => new.target;
|
||||
}
|
||||
|
||||
const O = {
|
||||
[new.target]: undefined,
|
||||
k() { return new.target; },
|
||||
get l() { return new.target; },
|
||||
set m(_) { _ = new.target; },
|
||||
n: new.target,
|
||||
};
|
||||
@@ -0,0 +1,32 @@
|
||||
// @target: es5
|
||||
class A {
|
||||
constructor() {
|
||||
const a = new.target;
|
||||
const b = () => new.target;
|
||||
}
|
||||
static c = function () { return new.target; }
|
||||
d = function () { return new.target; }
|
||||
}
|
||||
|
||||
class B extends A {
|
||||
constructor() {
|
||||
super();
|
||||
const e = new.target;
|
||||
const f = () => new.target;
|
||||
}
|
||||
}
|
||||
|
||||
function f1() {
|
||||
const g = new.target;
|
||||
const h = () => new.target;
|
||||
}
|
||||
|
||||
const f2 = function () {
|
||||
const i = new.target;
|
||||
const j = () => new.target;
|
||||
}
|
||||
|
||||
const O = {
|
||||
k: function () { return new.target; }
|
||||
};
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
// @target: es6
|
||||
class A {
|
||||
constructor() {
|
||||
const a = new.target;
|
||||
const b = () => new.target;
|
||||
}
|
||||
static c = function () { return new.target; }
|
||||
d = function () { return new.target; }
|
||||
}
|
||||
|
||||
class B extends A {
|
||||
constructor() {
|
||||
super();
|
||||
const e = new.target;
|
||||
const f = () => new.target;
|
||||
}
|
||||
}
|
||||
|
||||
function f1() {
|
||||
const g = new.target;
|
||||
const h = () => new.target;
|
||||
}
|
||||
|
||||
const f2 = function () {
|
||||
const i = new.target;
|
||||
const j = () => new.target;
|
||||
}
|
||||
|
||||
const O = {
|
||||
k: function () { return new.target; }
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user