mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-24 04:30:53 -06:00
Remove --strictThisChecks
This commit is contained in:
parent
1032cc5408
commit
c9f5f3d67e
@ -1307,9 +1307,6 @@ namespace ts {
|
||||
// as other properties in the object literal. So we use SymbolFlags.PropertyExcludes
|
||||
// so that it will conflict with any other object literal members with the same
|
||||
// name.
|
||||
if (options.strictThisChecks) {
|
||||
seenThisKeyword = true;
|
||||
}
|
||||
return bindPropertyOrMethodOrAccessor(<Declaration>node, SymbolFlags.Method | ((<MethodDeclaration>node).questionToken ? SymbolFlags.Optional : SymbolFlags.None),
|
||||
isObjectLiteralMethod(node) ? SymbolFlags.PropertyExcludes : SymbolFlags.MethodExcludes);
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
|
||||
@ -3520,7 +3520,6 @@ namespace ts {
|
||||
return isIndependentVariableLikeDeclaration(<VariableLikeDeclaration>declaration);
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
case SyntaxKind.MethodSignature:
|
||||
return compilerOptions.strictThisChecks ? false : isIndependentFunctionLikeDeclaration(<FunctionLikeDeclaration>declaration);
|
||||
case SyntaxKind.Constructor:
|
||||
return isIndependentFunctionLikeDeclaration(<FunctionLikeDeclaration>declaration);
|
||||
}
|
||||
@ -4234,21 +4233,6 @@ namespace ts {
|
||||
if (minArgumentCount < 0) {
|
||||
minArgumentCount = declaration.parameters.length - (hasThisParameter ? 1 : 0);
|
||||
}
|
||||
if (!hasThisParameter && compilerOptions.strictThisChecks) {
|
||||
if (declaration.kind === SyntaxKind.FunctionDeclaration ||
|
||||
declaration.kind === SyntaxKind.CallSignature ||
|
||||
declaration.kind == SyntaxKind.FunctionExpression ||
|
||||
declaration.kind === SyntaxKind.FunctionType) {
|
||||
thisType = voidType;
|
||||
}
|
||||
else if ((declaration.kind === SyntaxKind.MethodDeclaration || declaration.kind === SyntaxKind.MethodSignature)
|
||||
&& (isClassLike(declaration.parent) || declaration.parent.kind === SyntaxKind.InterfaceDeclaration)) {
|
||||
thisType = declaration.flags & NodeFlags.Static ?
|
||||
getTypeOfSymbol(getSymbolOfNode(declaration.parent)) :
|
||||
getThisType(declaration.name);
|
||||
Debug.assert(!!thisType, "couldn't find implicit this type");
|
||||
}
|
||||
}
|
||||
|
||||
if (isJSConstructSignature) {
|
||||
minArgumentCount--;
|
||||
|
||||
@ -137,10 +137,6 @@ namespace ts {
|
||||
name: "skipDefaultLibCheck",
|
||||
type: "boolean",
|
||||
},
|
||||
{
|
||||
name: "strictThisChecks",
|
||||
type: "boolean",
|
||||
},
|
||||
{
|
||||
name: "out",
|
||||
type: "string",
|
||||
|
||||
@ -2407,7 +2407,6 @@ namespace ts {
|
||||
rootDir?: string;
|
||||
sourceMap?: boolean;
|
||||
sourceRoot?: string;
|
||||
strictThisChecks?: boolean;
|
||||
suppressExcessPropertyErrors?: boolean;
|
||||
suppressImplicitAnyIndexErrors?: boolean;
|
||||
target?: ScriptTarget;
|
||||
|
||||
@ -8,9 +8,6 @@ class C {
|
||||
explicitThis(this: this, m: number): number {
|
||||
return this.n + m;
|
||||
}
|
||||
implicitThis(m: number): number {
|
||||
return this.n + m;
|
||||
}
|
||||
explicitC(this: C, m: number): number {
|
||||
return this.n + m;
|
||||
}
|
||||
@ -29,8 +26,6 @@ interface I {
|
||||
explicitStructural(this: {a: number}): number;
|
||||
explicitInterface(this: I): number;
|
||||
explicitThis(this: this): number;
|
||||
implicitMethod(): number;
|
||||
implicitFunction: () => number;
|
||||
}
|
||||
function explicitStructural(this: { y: number }, x: number): number {
|
||||
return x + this.y;
|
||||
@ -39,7 +34,7 @@ function justThis(this: { y: number }): number {
|
||||
return this.y;
|
||||
}
|
||||
function implicitThis(n: number): number {
|
||||
return 12;
|
||||
return this.m + n + 12;
|
||||
}
|
||||
let impl: I = {
|
||||
a: 12,
|
||||
@ -54,10 +49,6 @@ let impl: I = {
|
||||
explicitThis() {
|
||||
return this.a;
|
||||
},
|
||||
implicitMethod() {
|
||||
return this.a;
|
||||
},
|
||||
implicitFunction: () => this.a, // ok, this: any because it refers to some outer object (window?)
|
||||
}
|
||||
impl.explicitVoid1 = function () { return 12; };
|
||||
impl.explicitVoid2 = () => 12;
|
||||
@ -66,9 +57,6 @@ impl.explicitInterface = function() { return this.a; };
|
||||
impl.explicitStructural = () => 12;
|
||||
impl.explicitInterface = () => 12;
|
||||
impl.explicitThis = function () { return this.a; };
|
||||
impl.implicitMethod = function () { return this.a; };
|
||||
impl.implicitMethod = () => 12;
|
||||
impl.implicitFunction = () => this.a; // ok, this: any because it refers to some outer object (window?)
|
||||
// parameter checking
|
||||
let ok: {y: number, f: (this: { y: number }, x: number) => number} = { y: 12, f: explicitStructural };
|
||||
let implicitAnyOk: {notSpecified: number, f: (x: number) => number} = { notSpecified: 12, f: implicitThis };
|
||||
@ -82,29 +70,26 @@ let ripped = c.explicitC;
|
||||
c.explicitC(12);
|
||||
c.explicitProperty(12);
|
||||
c.explicitThis(12);
|
||||
c.implicitThis(12);
|
||||
d.explicitC(12);
|
||||
d.explicitProperty(12);
|
||||
d.explicitThis(12);
|
||||
d.implicitThis(12);
|
||||
let reconstructed: {
|
||||
n: number,
|
||||
explicitThis(this: C, m: number): number, // note: this: this is not allowed in an object literal type.
|
||||
implicitThis(m: number): number,
|
||||
explicitC(this: C, m: number): number,
|
||||
explicitProperty: (this: {n : number}, m: number) => number,
|
||||
explicitVoid(this: void, m: number): number,
|
||||
} = {
|
||||
n: 12,
|
||||
explicitThis: c.explicitThis,
|
||||
implicitThis: c.implicitThis,
|
||||
explicitC: c.explicitC,
|
||||
explicitProperty: c.explicitProperty,
|
||||
explicitVoid: c.explicitVoid
|
||||
};
|
||||
reconstructed.explicitThis(10);
|
||||
reconstructed.explicitProperty(11);
|
||||
reconstructed.implicitThis(11);
|
||||
|
||||
let explicitVoid = reconstructed.explicitVoid;
|
||||
explicitVoid(12);
|
||||
// assignment checking
|
||||
let unboundToSpecified: (this: { y: number }, x: number) => number = x => x + this.y; // ok, this:any
|
||||
let specifiedToSpecified: (this: {y: number}, x: number) => number = explicitStructural;
|
||||
@ -143,8 +128,6 @@ c.explicitThis = function(this: C, m: number) { return this.n + m };
|
||||
c.explicitC = function(m) { return this.n + m };
|
||||
c.explicitProperty = function(m) { return this.n + m };
|
||||
c.explicitThis = function(m) { return this.n + m };
|
||||
c.implicitThis = function(m) { return this.n + m };
|
||||
c.implicitThis = reconstructed.implicitThis;
|
||||
|
||||
c.explicitC = function(this: B, m: number) { return this.n + m };
|
||||
|
||||
@ -154,19 +137,17 @@ c.explicitVoid = n => n;
|
||||
// class-based assignability
|
||||
class Base1 {
|
||||
x: number;
|
||||
public implicit(): number { return this.x; }
|
||||
public polymorphic(this: this): number { return this.x; }
|
||||
explicit(this: Base1): number { return this.x; }
|
||||
static implicitStatic(): number { return this.y; }
|
||||
static explicitStatic(this: typeof Base1): number { return this.y; }
|
||||
static y: number;
|
||||
|
||||
}
|
||||
class Derived1 extends Base1 {
|
||||
y: number
|
||||
}
|
||||
class Base2 {
|
||||
y: number
|
||||
implicit(): number { return this.y; }
|
||||
polymorphic(this: this): number { return this.y; }
|
||||
explicit(this: Base1): number { return this.x; }
|
||||
}
|
||||
class Derived2 extends Base2 {
|
||||
@ -176,14 +157,14 @@ let b1 = new Base1();
|
||||
let b2 = new Base2();
|
||||
let d1 = new Derived1();
|
||||
let d2 = new Derived2();
|
||||
d2.implicit = d1.implicit // ok, 'x' and 'y' in { x, y } (d assignable to f and vice versa)
|
||||
d1.implicit = d2.implicit // ok, 'x' and 'y' in { x, y } (f assignable to d and vice versa)
|
||||
d2.polymorphic = d1.polymorphic // ok, 'x' and 'y' in { x, y }
|
||||
d1.polymorphic = d2.polymorphic // ok, 'x' and 'y' in { x, y }
|
||||
|
||||
// bivariance-allowed cases
|
||||
d1.implicit = b2.implicit // ok, 'y' in D: { x, y } (d assignable e)
|
||||
d2.implicit = d1.explicit // ok, 'y' in { x, y } (c assignable to f)
|
||||
b1.implicit = d2.implicit // ok, 'x' and 'y' not in C: { x } (c assignable to f)
|
||||
b1.explicit = d2.implicit // ok, 'x' and 'y' not in C: { x } (c assignable to f)
|
||||
d1.polymorphic = b2.polymorphic // ok, 'y' in D: { x, y }
|
||||
d2.polymorphic = d1.explicit // ok, 'y' in { x, y }
|
||||
b1.polymorphic = d2.polymorphic // ok, 'x' and 'y' not in Base1: { x }
|
||||
b1.explicit = d2.polymorphic // ok, 'x' and 'y' not in Base1: { x }
|
||||
|
||||
////// use this-type for construction with new ////
|
||||
function InterfaceThis(this: I) {
|
||||
@ -206,7 +187,7 @@ declare var f: {
|
||||
};
|
||||
let n: number = f.call(12);
|
||||
|
||||
function missingTypeIsImplicitAny(this, a: number) { return a; }
|
||||
function missingTypeIsImplicitAny(this, a: number) { return this.anything + a; }
|
||||
|
||||
|
||||
//// [thisTypeInFunctions.js]
|
||||
@ -228,9 +209,6 @@ var C = (function () {
|
||||
C.prototype.explicitThis = function (m) {
|
||||
return this.n + m;
|
||||
};
|
||||
C.prototype.implicitThis = function (m) {
|
||||
return this.n + m;
|
||||
};
|
||||
C.prototype.explicitC = function (m) {
|
||||
return this.n + m;
|
||||
};
|
||||
@ -256,7 +234,7 @@ function justThis() {
|
||||
return this.y;
|
||||
}
|
||||
function implicitThis(n) {
|
||||
return 12;
|
||||
return this.m + n + 12;
|
||||
}
|
||||
var impl = {
|
||||
a: 12,
|
||||
@ -270,11 +248,7 @@ var impl = {
|
||||
},
|
||||
explicitThis: function () {
|
||||
return this.a;
|
||||
},
|
||||
implicitMethod: function () {
|
||||
return this.a;
|
||||
},
|
||||
implicitFunction: function () { return _this.a; }
|
||||
}
|
||||
};
|
||||
impl.explicitVoid1 = function () { return 12; };
|
||||
impl.explicitVoid2 = function () { return 12; };
|
||||
@ -283,9 +257,6 @@ impl.explicitInterface = function () { return this.a; };
|
||||
impl.explicitStructural = function () { return 12; };
|
||||
impl.explicitInterface = function () { return 12; };
|
||||
impl.explicitThis = function () { return this.a; };
|
||||
impl.implicitMethod = function () { return this.a; };
|
||||
impl.implicitMethod = function () { return 12; };
|
||||
impl.implicitFunction = function () { return _this.a; }; // ok, this: any because it refers to some outer object (window?)
|
||||
// parameter checking
|
||||
var ok = { y: 12, f: explicitStructural };
|
||||
var implicitAnyOk = { notSpecified: 12, f: implicitThis };
|
||||
@ -298,21 +269,20 @@ var ripped = c.explicitC;
|
||||
c.explicitC(12);
|
||||
c.explicitProperty(12);
|
||||
c.explicitThis(12);
|
||||
c.implicitThis(12);
|
||||
d.explicitC(12);
|
||||
d.explicitProperty(12);
|
||||
d.explicitThis(12);
|
||||
d.implicitThis(12);
|
||||
var reconstructed = {
|
||||
n: 12,
|
||||
explicitThis: c.explicitThis,
|
||||
implicitThis: c.implicitThis,
|
||||
explicitC: c.explicitC,
|
||||
explicitProperty: c.explicitProperty,
|
||||
explicitVoid: c.explicitVoid
|
||||
};
|
||||
reconstructed.explicitThis(10);
|
||||
reconstructed.explicitProperty(11);
|
||||
reconstructed.implicitThis(11);
|
||||
var explicitVoid = reconstructed.explicitVoid;
|
||||
explicitVoid(12);
|
||||
// assignment checking
|
||||
var unboundToSpecified = function (x) { return x + _this.y; }; // ok, this:any
|
||||
var specifiedToSpecified = explicitStructural;
|
||||
@ -344,8 +314,6 @@ c.explicitThis = function (m) { return this.n + m; };
|
||||
c.explicitC = function (m) { return this.n + m; };
|
||||
c.explicitProperty = function (m) { return this.n + m; };
|
||||
c.explicitThis = function (m) { return this.n + m; };
|
||||
c.implicitThis = function (m) { return this.n + m; };
|
||||
c.implicitThis = reconstructed.implicitThis;
|
||||
c.explicitC = function (m) { return this.n + m; };
|
||||
// this:void compatibility
|
||||
c.explicitVoid = function (n) { return n; };
|
||||
@ -353,9 +321,8 @@ c.explicitVoid = function (n) { return n; };
|
||||
var Base1 = (function () {
|
||||
function Base1() {
|
||||
}
|
||||
Base1.prototype.implicit = function () { return this.x; };
|
||||
Base1.prototype.polymorphic = function () { return this.x; };
|
||||
Base1.prototype.explicit = function () { return this.x; };
|
||||
Base1.implicitStatic = function () { return this.y; };
|
||||
Base1.explicitStatic = function () { return this.y; };
|
||||
return Base1;
|
||||
}());
|
||||
@ -369,7 +336,7 @@ var Derived1 = (function (_super) {
|
||||
var Base2 = (function () {
|
||||
function Base2() {
|
||||
}
|
||||
Base2.prototype.implicit = function () { return this.y; };
|
||||
Base2.prototype.polymorphic = function () { return this.y; };
|
||||
Base2.prototype.explicit = function () { return this.x; };
|
||||
return Base2;
|
||||
}());
|
||||
@ -384,13 +351,13 @@ var b1 = new Base1();
|
||||
var b2 = new Base2();
|
||||
var d1 = new Derived1();
|
||||
var d2 = new Derived2();
|
||||
d2.implicit = d1.implicit; // ok, 'x' and 'y' in { x, y } (d assignable to f and vice versa)
|
||||
d1.implicit = d2.implicit; // ok, 'x' and 'y' in { x, y } (f assignable to d and vice versa)
|
||||
d2.polymorphic = d1.polymorphic; // ok, 'x' and 'y' in { x, y }
|
||||
d1.polymorphic = d2.polymorphic; // ok, 'x' and 'y' in { x, y }
|
||||
// bivariance-allowed cases
|
||||
d1.implicit = b2.implicit; // ok, 'y' in D: { x, y } (d assignable e)
|
||||
d2.implicit = d1.explicit; // ok, 'y' in { x, y } (c assignable to f)
|
||||
b1.implicit = d2.implicit; // ok, 'x' and 'y' not in C: { x } (c assignable to f)
|
||||
b1.explicit = d2.implicit; // ok, 'x' and 'y' not in C: { x } (c assignable to f)
|
||||
d1.polymorphic = b2.polymorphic; // ok, 'y' in D: { x, y }
|
||||
d2.polymorphic = d1.explicit; // ok, 'y' in { x, y }
|
||||
b1.polymorphic = d2.polymorphic; // ok, 'x' and 'y' not in Base1: { x }
|
||||
b1.explicit = d2.polymorphic; // ok, 'x' and 'y' not in Base1: { x }
|
||||
////// use this-type for construction with new ////
|
||||
function InterfaceThis() {
|
||||
this.a = 12;
|
||||
@ -405,4 +372,4 @@ var interfaceThis = new InterfaceThis();
|
||||
var literalTypeThis = new LiteralTypeThis();
|
||||
var anyThis = new AnyThis();
|
||||
var n = f.call(12);
|
||||
function missingTypeIsImplicitAny(a) { return a; }
|
||||
function missingTypeIsImplicitAny(a) { return this.anything + a; }
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -22,17 +22,6 @@ class C {
|
||||
>this.n : number
|
||||
>this : this
|
||||
>n : number
|
||||
>m : number
|
||||
}
|
||||
implicitThis(m: number): number {
|
||||
>implicitThis : (this: this, m: number) => number
|
||||
>m : number
|
||||
|
||||
return this.n + m;
|
||||
>this.n + m : number
|
||||
>this.n : number
|
||||
>this : this
|
||||
>n : number
|
||||
>m : number
|
||||
}
|
||||
explicitC(this: C, m: number): number {
|
||||
@ -103,12 +92,6 @@ interface I {
|
||||
explicitThis(this: this): number;
|
||||
>explicitThis : (this: this) => number
|
||||
>this : this
|
||||
|
||||
implicitMethod(): number;
|
||||
>implicitMethod : (this: this) => number
|
||||
|
||||
implicitFunction: () => number;
|
||||
>implicitFunction : (this: void) => number
|
||||
}
|
||||
function explicitStructural(this: { y: number }, x: number): number {
|
||||
>explicitStructural : (this: { y: number; }, x: number) => number
|
||||
@ -134,16 +117,22 @@ function justThis(this: { y: number }): number {
|
||||
>y : number
|
||||
}
|
||||
function implicitThis(n: number): number {
|
||||
>implicitThis : (this: void, n: number) => number
|
||||
>implicitThis : (n: number) => number
|
||||
>n : number
|
||||
|
||||
return 12;
|
||||
return this.m + n + 12;
|
||||
>this.m + n + 12 : any
|
||||
>this.m + n : any
|
||||
>this.m : any
|
||||
>this : any
|
||||
>m : any
|
||||
>n : number
|
||||
>12 : number
|
||||
}
|
||||
let impl: I = {
|
||||
>impl : I
|
||||
>I : I
|
||||
>{ a: 12, explicitVoid2: () => this.a, // ok, this: any because it refers to some outer object (window?) explicitVoid1() { return 12; }, explicitStructural() { return this.a; }, explicitInterface() { return this.a; }, explicitThis() { return this.a; }, implicitMethod() { return this.a; }, implicitFunction: () => this.a, // ok, this: any because it refers to some outer object (window?)} : { a: number; explicitVoid2: () => any; explicitVoid1(): number; explicitStructural(): number; explicitInterface(): number; explicitThis(): number; implicitMethod(): number; implicitFunction: () => any; }
|
||||
>{ a: 12, explicitVoid2: () => this.a, // ok, this: any because it refers to some outer object (window?) explicitVoid1() { return 12; }, explicitStructural() { return this.a; }, explicitInterface() { return this.a; }, explicitThis() { return this.a; },} : { a: number; explicitVoid2: () => any; explicitVoid1(): number; explicitStructural(): number; explicitInterface(): number; explicitThis(): number; }
|
||||
|
||||
a: 12,
|
||||
>a : number
|
||||
@ -187,28 +176,13 @@ let impl: I = {
|
||||
>a : number
|
||||
|
||||
},
|
||||
implicitMethod() {
|
||||
>implicitMethod : () => number
|
||||
|
||||
return this.a;
|
||||
>this.a : number
|
||||
>this : I
|
||||
>a : number
|
||||
|
||||
},
|
||||
implicitFunction: () => this.a, // ok, this: any because it refers to some outer object (window?)
|
||||
>implicitFunction : () => any
|
||||
>() => this.a : () => any
|
||||
>this.a : any
|
||||
>this : any
|
||||
>a : any
|
||||
}
|
||||
impl.explicitVoid1 = function () { return 12; };
|
||||
>impl.explicitVoid1 = function () { return 12; } : (this: void) => number
|
||||
>impl.explicitVoid1 = function () { return 12; } : () => number
|
||||
>impl.explicitVoid1 : (this: void) => number
|
||||
>impl : I
|
||||
>explicitVoid1 : (this: void) => number
|
||||
>function () { return 12; } : (this: void) => number
|
||||
>function () { return 12; } : () => number
|
||||
>12 : number
|
||||
|
||||
impl.explicitVoid2 = () => 12;
|
||||
@ -220,21 +194,21 @@ impl.explicitVoid2 = () => 12;
|
||||
>12 : number
|
||||
|
||||
impl.explicitStructural = function() { return this.a; };
|
||||
>impl.explicitStructural = function() { return this.a; } : (this: void) => number
|
||||
>impl.explicitStructural = function() { return this.a; } : () => number
|
||||
>impl.explicitStructural : (this: { a: number; }) => number
|
||||
>impl : I
|
||||
>explicitStructural : (this: { a: number; }) => number
|
||||
>function() { return this.a; } : (this: void) => number
|
||||
>function() { return this.a; } : () => number
|
||||
>this.a : number
|
||||
>this : { a: number; }
|
||||
>a : number
|
||||
|
||||
impl.explicitInterface = function() { return this.a; };
|
||||
>impl.explicitInterface = function() { return this.a; } : (this: void) => number
|
||||
>impl.explicitInterface = function() { return this.a; } : () => number
|
||||
>impl.explicitInterface : (this: I) => number
|
||||
>impl : I
|
||||
>explicitInterface : (this: I) => number
|
||||
>function() { return this.a; } : (this: void) => number
|
||||
>function() { return this.a; } : () => number
|
||||
>this.a : number
|
||||
>this : I
|
||||
>a : number
|
||||
@ -256,43 +230,15 @@ impl.explicitInterface = () => 12;
|
||||
>12 : number
|
||||
|
||||
impl.explicitThis = function () { return this.a; };
|
||||
>impl.explicitThis = function () { return this.a; } : (this: void) => number
|
||||
>impl.explicitThis = function () { return this.a; } : () => number
|
||||
>impl.explicitThis : (this: I) => number
|
||||
>impl : I
|
||||
>explicitThis : (this: I) => number
|
||||
>function () { return this.a; } : (this: void) => number
|
||||
>function () { return this.a; } : () => number
|
||||
>this.a : number
|
||||
>this : I
|
||||
>a : number
|
||||
|
||||
impl.implicitMethod = function () { return this.a; };
|
||||
>impl.implicitMethod = function () { return this.a; } : (this: void) => number
|
||||
>impl.implicitMethod : (this: I) => number
|
||||
>impl : I
|
||||
>implicitMethod : (this: I) => number
|
||||
>function () { return this.a; } : (this: void) => number
|
||||
>this.a : number
|
||||
>this : I
|
||||
>a : number
|
||||
|
||||
impl.implicitMethod = () => 12;
|
||||
>impl.implicitMethod = () => 12 : () => number
|
||||
>impl.implicitMethod : (this: I) => number
|
||||
>impl : I
|
||||
>implicitMethod : (this: I) => number
|
||||
>() => 12 : () => number
|
||||
>12 : number
|
||||
|
||||
impl.implicitFunction = () => this.a; // ok, this: any because it refers to some outer object (window?)
|
||||
>impl.implicitFunction = () => this.a : () => any
|
||||
>impl.implicitFunction : (this: void) => number
|
||||
>impl : I
|
||||
>implicitFunction : (this: void) => number
|
||||
>() => this.a : () => any
|
||||
>this.a : any
|
||||
>this : any
|
||||
>a : any
|
||||
|
||||
// parameter checking
|
||||
let ok: {y: number, f: (this: { y: number }, x: number) => number} = { y: 12, f: explicitStructural };
|
||||
>ok : { y: number; f: (this: { y: number; }, x: number) => number; }
|
||||
@ -308,15 +254,15 @@ let ok: {y: number, f: (this: { y: number }, x: number) => number} = { y: 12, f:
|
||||
>explicitStructural : (this: { y: number; }, x: number) => number
|
||||
|
||||
let implicitAnyOk: {notSpecified: number, f: (x: number) => number} = { notSpecified: 12, f: implicitThis };
|
||||
>implicitAnyOk : { notSpecified: number; f: (this: void, x: number) => number; }
|
||||
>implicitAnyOk : { notSpecified: number; f: (x: number) => number; }
|
||||
>notSpecified : number
|
||||
>f : (this: void, x: number) => number
|
||||
>f : (x: number) => number
|
||||
>x : number
|
||||
>{ notSpecified: 12, f: implicitThis } : { notSpecified: number; f: (this: void, n: number) => number; }
|
||||
>{ notSpecified: 12, f: implicitThis } : { notSpecified: number; f: (n: number) => number; }
|
||||
>notSpecified : number
|
||||
>12 : number
|
||||
>f : (this: void, n: number) => number
|
||||
>implicitThis : (this: void, n: number) => number
|
||||
>f : (n: number) => number
|
||||
>implicitThis : (n: number) => number
|
||||
|
||||
ok.f(13);
|
||||
>ok.f(13) : number
|
||||
@ -327,14 +273,14 @@ ok.f(13);
|
||||
|
||||
implicitThis(12);
|
||||
>implicitThis(12) : number
|
||||
>implicitThis : (this: void, n: number) => number
|
||||
>implicitThis : (n: number) => number
|
||||
>12 : number
|
||||
|
||||
implicitAnyOk.f(12);
|
||||
>implicitAnyOk.f(12) : number
|
||||
>implicitAnyOk.f : (this: void, x: number) => number
|
||||
>implicitAnyOk : { notSpecified: number; f: (this: void, x: number) => number; }
|
||||
>f : (this: void, x: number) => number
|
||||
>implicitAnyOk.f : (x: number) => number
|
||||
>implicitAnyOk : { notSpecified: number; f: (x: number) => number; }
|
||||
>f : (x: number) => number
|
||||
>12 : number
|
||||
|
||||
let c = new C();
|
||||
@ -374,13 +320,6 @@ c.explicitThis(12);
|
||||
>explicitThis : (this: C, m: number) => number
|
||||
>12 : number
|
||||
|
||||
c.implicitThis(12);
|
||||
>c.implicitThis(12) : number
|
||||
>c.implicitThis : (this: C, m: number) => number
|
||||
>c : C
|
||||
>implicitThis : (this: C, m: number) => number
|
||||
>12 : number
|
||||
|
||||
d.explicitC(12);
|
||||
>d.explicitC(12) : number
|
||||
>d.explicitC : (this: C, m: number) => number
|
||||
@ -402,15 +341,8 @@ d.explicitThis(12);
|
||||
>explicitThis : (this: D, m: number) => number
|
||||
>12 : number
|
||||
|
||||
d.implicitThis(12);
|
||||
>d.implicitThis(12) : number
|
||||
>d.implicitThis : (this: D, m: number) => number
|
||||
>d : D
|
||||
>implicitThis : (this: D, m: number) => number
|
||||
>12 : number
|
||||
|
||||
let reconstructed: {
|
||||
>reconstructed : { n: number; explicitThis(this: C, m: number): number; implicitThis(m: number): number; explicitC(this: C, m: number): number; explicitProperty: (this: { n: number; }, m: number) => number; explicitVoid(this: void, m: number): number; }
|
||||
>reconstructed : { n: number; explicitThis(this: C, m: number): number; explicitC(this: C, m: number): number; explicitProperty: (this: { n: number; }, m: number) => number; explicitVoid(this: void, m: number): number; }
|
||||
|
||||
n: number,
|
||||
>n : number
|
||||
@ -419,10 +351,6 @@ let reconstructed: {
|
||||
>explicitThis : (this: C, m: number) => number
|
||||
>this : C
|
||||
>C : C
|
||||
>m : number
|
||||
|
||||
implicitThis(m: number): number,
|
||||
>implicitThis : (m: number) => number
|
||||
>m : number
|
||||
|
||||
explicitC(this: C, m: number): number,
|
||||
@ -443,7 +371,7 @@ let reconstructed: {
|
||||
>m : number
|
||||
|
||||
} = {
|
||||
>{ n: 12, explicitThis: c.explicitThis, implicitThis: c.implicitThis, explicitC: c.explicitC, explicitProperty: c.explicitProperty, explicitVoid: c.explicitVoid} : { n: number; explicitThis: (this: C, m: number) => number; implicitThis: (this: C, m: number) => number; explicitC: (this: C, m: number) => number; explicitProperty: (this: { n: number; }, m: number) => number; explicitVoid: (this: void, m: number) => number; }
|
||||
>{ n: 12, explicitThis: c.explicitThis, explicitC: c.explicitC, explicitProperty: c.explicitProperty, explicitVoid: c.explicitVoid} : { n: number; explicitThis: (this: C, m: number) => number; explicitC: (this: C, m: number) => number; explicitProperty: (this: { n: number; }, m: number) => number; explicitVoid: (this: void, m: number) => number; }
|
||||
|
||||
n: 12,
|
||||
>n : number
|
||||
@ -455,12 +383,6 @@ let reconstructed: {
|
||||
>c : C
|
||||
>explicitThis : (this: C, m: number) => number
|
||||
|
||||
implicitThis: c.implicitThis,
|
||||
>implicitThis : (this: C, m: number) => number
|
||||
>c.implicitThis : (this: C, m: number) => number
|
||||
>c : C
|
||||
>implicitThis : (this: C, m: number) => number
|
||||
|
||||
explicitC: c.explicitC,
|
||||
>explicitC : (this: C, m: number) => number
|
||||
>c.explicitC : (this: C, m: number) => number
|
||||
@ -480,19 +402,30 @@ let reconstructed: {
|
||||
>explicitVoid : (this: void, m: number) => number
|
||||
|
||||
};
|
||||
reconstructed.explicitThis(10);
|
||||
>reconstructed.explicitThis(10) : number
|
||||
>reconstructed.explicitThis : (this: C, m: number) => number
|
||||
>reconstructed : { n: number; explicitThis(this: C, m: number): number; explicitC(this: C, m: number): number; explicitProperty: (this: { n: number; }, m: number) => number; explicitVoid(this: void, m: number): number; }
|
||||
>explicitThis : (this: C, m: number) => number
|
||||
>10 : number
|
||||
|
||||
reconstructed.explicitProperty(11);
|
||||
>reconstructed.explicitProperty(11) : number
|
||||
>reconstructed.explicitProperty : (this: { n: number; }, m: number) => number
|
||||
>reconstructed : { n: number; explicitThis(this: C, m: number): number; implicitThis(m: number): number; explicitC(this: C, m: number): number; explicitProperty: (this: { n: number; }, m: number) => number; explicitVoid(this: void, m: number): number; }
|
||||
>reconstructed : { n: number; explicitThis(this: C, m: number): number; explicitC(this: C, m: number): number; explicitProperty: (this: { n: number; }, m: number) => number; explicitVoid(this: void, m: number): number; }
|
||||
>explicitProperty : (this: { n: number; }, m: number) => number
|
||||
>11 : number
|
||||
|
||||
reconstructed.implicitThis(11);
|
||||
>reconstructed.implicitThis(11) : number
|
||||
>reconstructed.implicitThis : (m: number) => number
|
||||
>reconstructed : { n: number; explicitThis(this: C, m: number): number; implicitThis(m: number): number; explicitC(this: C, m: number): number; explicitProperty: (this: { n: number; }, m: number) => number; explicitVoid(this: void, m: number): number; }
|
||||
>implicitThis : (m: number) => number
|
||||
>11 : number
|
||||
let explicitVoid = reconstructed.explicitVoid;
|
||||
>explicitVoid : (this: void, m: number) => number
|
||||
>reconstructed.explicitVoid : (this: void, m: number) => number
|
||||
>reconstructed : { n: number; explicitThis(this: C, m: number): number; explicitC(this: C, m: number): number; explicitProperty: (this: { n: number; }, m: number) => number; explicitVoid(this: void, m: number): number; }
|
||||
>explicitVoid : (this: void, m: number) => number
|
||||
|
||||
explicitVoid(12);
|
||||
>explicitVoid(12) : number
|
||||
>explicitVoid : (this: void, m: number) => number
|
||||
>12 : number
|
||||
|
||||
// assignment checking
|
||||
let unboundToSpecified: (this: { y: number }, x: number) => number = x => x + this.y; // ok, this:any
|
||||
@ -520,14 +453,14 @@ let anyToSpecified: (this: { y: number }, x: number) => number = function(x: num
|
||||
>this : { y: number; }
|
||||
>y : number
|
||||
>x : number
|
||||
>function(x: number): number { return x + 12; } : (this: void, x: number) => number
|
||||
>function(x: number): number { return x + 12; } : (x: number) => number
|
||||
>x : number
|
||||
>x + 12 : number
|
||||
>x : number
|
||||
>12 : number
|
||||
|
||||
let unspecifiedLambda: (x: number) => number = x => x + 12;
|
||||
>unspecifiedLambda : (this: void, x: number) => number
|
||||
>unspecifiedLambda : (x: number) => number
|
||||
>x : number
|
||||
>x => x + 12 : (x: number) => number
|
||||
>x : number
|
||||
@ -550,7 +483,7 @@ let unspecifiedLambdaToSpecified: (this: {y: number}, x: number) => number = uns
|
||||
>this : { y: number; }
|
||||
>y : number
|
||||
>x : number
|
||||
>unspecifiedLambda : (this: void, x: number) => number
|
||||
>unspecifiedLambda : (x: number) => number
|
||||
|
||||
let specifiedLambdaToSpecified: (this: {y: number}, x: number) => number = specifiedLambda;
|
||||
>specifiedLambdaToSpecified : (this: { y: number; }, x: number) => number
|
||||
@ -622,7 +555,7 @@ c.explicitProperty = reconstructed.explicitProperty;
|
||||
>c : C
|
||||
>explicitProperty : (this: { n: number; }, m: number) => number
|
||||
>reconstructed.explicitProperty : (this: { n: number; }, m: number) => number
|
||||
>reconstructed : { n: number; explicitThis(this: C, m: number): number; implicitThis(m: number): number; explicitC(this: C, m: number): number; explicitProperty: (this: { n: number; }, m: number) => number; explicitVoid(this: void, m: number): number; }
|
||||
>reconstructed : { n: number; explicitThis(this: C, m: number): number; explicitC(this: C, m: number): number; explicitProperty: (this: { n: number; }, m: number) => number; explicitVoid(this: void, m: number): number; }
|
||||
>explicitProperty : (this: { n: number; }, m: number) => number
|
||||
|
||||
// lambdas are assignable to anything
|
||||
@ -719,11 +652,11 @@ c.explicitThis = function(this: C, m: number) { return this.n + m };
|
||||
|
||||
// this:any compatibility
|
||||
c.explicitC = function(m) { return this.n + m };
|
||||
>c.explicitC = function(m) { return this.n + m } : (this: void, m: number) => number
|
||||
>c.explicitC = function(m) { return this.n + m } : (m: number) => number
|
||||
>c.explicitC : (this: C, m: number) => number
|
||||
>c : C
|
||||
>explicitC : (this: C, m: number) => number
|
||||
>function(m) { return this.n + m } : (this: void, m: number) => number
|
||||
>function(m) { return this.n + m } : (m: number) => number
|
||||
>m : number
|
||||
>this.n + m : number
|
||||
>this.n : number
|
||||
@ -732,11 +665,11 @@ c.explicitC = function(m) { return this.n + m };
|
||||
>m : number
|
||||
|
||||
c.explicitProperty = function(m) { return this.n + m };
|
||||
>c.explicitProperty = function(m) { return this.n + m } : (this: void, m: number) => number
|
||||
>c.explicitProperty = function(m) { return this.n + m } : (m: number) => number
|
||||
>c.explicitProperty : (this: { n: number; }, m: number) => number
|
||||
>c : C
|
||||
>explicitProperty : (this: { n: number; }, m: number) => number
|
||||
>function(m) { return this.n + m } : (this: void, m: number) => number
|
||||
>function(m) { return this.n + m } : (m: number) => number
|
||||
>m : number
|
||||
>this.n + m : number
|
||||
>this.n : number
|
||||
@ -745,11 +678,11 @@ c.explicitProperty = function(m) { return this.n + m };
|
||||
>m : number
|
||||
|
||||
c.explicitThis = function(m) { return this.n + m };
|
||||
>c.explicitThis = function(m) { return this.n + m } : (this: void, m: number) => number
|
||||
>c.explicitThis = function(m) { return this.n + m } : (m: number) => number
|
||||
>c.explicitThis : (this: C, m: number) => number
|
||||
>c : C
|
||||
>explicitThis : (this: C, m: number) => number
|
||||
>function(m) { return this.n + m } : (this: void, m: number) => number
|
||||
>function(m) { return this.n + m } : (m: number) => number
|
||||
>m : number
|
||||
>this.n + m : number
|
||||
>this.n : number
|
||||
@ -757,28 +690,6 @@ c.explicitThis = function(m) { return this.n + m };
|
||||
>n : number
|
||||
>m : number
|
||||
|
||||
c.implicitThis = function(m) { return this.n + m };
|
||||
>c.implicitThis = function(m) { return this.n + m } : (this: void, m: number) => number
|
||||
>c.implicitThis : (this: C, m: number) => number
|
||||
>c : C
|
||||
>implicitThis : (this: C, m: number) => number
|
||||
>function(m) { return this.n + m } : (this: void, m: number) => number
|
||||
>m : number
|
||||
>this.n + m : number
|
||||
>this.n : number
|
||||
>this : C
|
||||
>n : number
|
||||
>m : number
|
||||
|
||||
c.implicitThis = reconstructed.implicitThis;
|
||||
>c.implicitThis = reconstructed.implicitThis : (m: number) => number
|
||||
>c.implicitThis : (this: C, m: number) => number
|
||||
>c : C
|
||||
>implicitThis : (this: C, m: number) => number
|
||||
>reconstructed.implicitThis : (m: number) => number
|
||||
>reconstructed : { n: number; explicitThis(this: C, m: number): number; implicitThis(m: number): number; explicitC(this: C, m: number): number; explicitProperty: (this: { n: number; }, m: number) => number; explicitVoid(this: void, m: number): number; }
|
||||
>implicitThis : (m: number) => number
|
||||
|
||||
c.explicitC = function(this: B, m: number) { return this.n + m };
|
||||
>c.explicitC = function(this: B, m: number) { return this.n + m } : (this: B, m: number) => number
|
||||
>c.explicitC : (this: C, m: number) => number
|
||||
@ -811,8 +722,9 @@ class Base1 {
|
||||
x: number;
|
||||
>x : number
|
||||
|
||||
public implicit(): number { return this.x; }
|
||||
>implicit : (this: this) => number
|
||||
public polymorphic(this: this): number { return this.x; }
|
||||
>polymorphic : (this: this) => number
|
||||
>this : this
|
||||
>this.x : number
|
||||
>this : this
|
||||
>x : number
|
||||
@ -825,12 +737,6 @@ class Base1 {
|
||||
>this : Base1
|
||||
>x : number
|
||||
|
||||
static implicitStatic(): number { return this.y; }
|
||||
>implicitStatic : (this: typeof Base1) => number
|
||||
>this.y : number
|
||||
>this : typeof Base1
|
||||
>y : number
|
||||
|
||||
static explicitStatic(this: typeof Base1): number { return this.y; }
|
||||
>explicitStatic : (this: typeof Base1) => number
|
||||
>this : typeof Base1
|
||||
@ -841,7 +747,6 @@ class Base1 {
|
||||
|
||||
static y: number;
|
||||
>y : number
|
||||
|
||||
}
|
||||
class Derived1 extends Base1 {
|
||||
>Derived1 : Derived1
|
||||
@ -856,8 +761,9 @@ class Base2 {
|
||||
y: number
|
||||
>y : number
|
||||
|
||||
implicit(): number { return this.y; }
|
||||
>implicit : (this: this) => number
|
||||
polymorphic(this: this): number { return this.y; }
|
||||
>polymorphic : (this: this) => number
|
||||
>this : this
|
||||
>this.y : number
|
||||
>this : this
|
||||
>y : number
|
||||
@ -897,60 +803,60 @@ let d2 = new Derived2();
|
||||
>new Derived2() : Derived2
|
||||
>Derived2 : typeof Derived2
|
||||
|
||||
d2.implicit = d1.implicit // ok, 'x' and 'y' in { x, y } (d assignable to f and vice versa)
|
||||
>d2.implicit = d1.implicit : (this: Derived1) => number
|
||||
>d2.implicit : (this: Derived2) => number
|
||||
d2.polymorphic = d1.polymorphic // ok, 'x' and 'y' in { x, y }
|
||||
>d2.polymorphic = d1.polymorphic : (this: Derived1) => number
|
||||
>d2.polymorphic : (this: Derived2) => number
|
||||
>d2 : Derived2
|
||||
>implicit : (this: Derived2) => number
|
||||
>d1.implicit : (this: Derived1) => number
|
||||
>polymorphic : (this: Derived2) => number
|
||||
>d1.polymorphic : (this: Derived1) => number
|
||||
>d1 : Derived1
|
||||
>implicit : (this: Derived1) => number
|
||||
>polymorphic : (this: Derived1) => number
|
||||
|
||||
d1.implicit = d2.implicit // ok, 'x' and 'y' in { x, y } (f assignable to d and vice versa)
|
||||
>d1.implicit = d2.implicit : (this: Derived2) => number
|
||||
>d1.implicit : (this: Derived1) => number
|
||||
d1.polymorphic = d2.polymorphic // ok, 'x' and 'y' in { x, y }
|
||||
>d1.polymorphic = d2.polymorphic : (this: Derived2) => number
|
||||
>d1.polymorphic : (this: Derived1) => number
|
||||
>d1 : Derived1
|
||||
>implicit : (this: Derived1) => number
|
||||
>d2.implicit : (this: Derived2) => number
|
||||
>polymorphic : (this: Derived1) => number
|
||||
>d2.polymorphic : (this: Derived2) => number
|
||||
>d2 : Derived2
|
||||
>implicit : (this: Derived2) => number
|
||||
>polymorphic : (this: Derived2) => number
|
||||
|
||||
// bivariance-allowed cases
|
||||
d1.implicit = b2.implicit // ok, 'y' in D: { x, y } (d assignable e)
|
||||
>d1.implicit = b2.implicit : (this: Base2) => number
|
||||
>d1.implicit : (this: Derived1) => number
|
||||
d1.polymorphic = b2.polymorphic // ok, 'y' in D: { x, y }
|
||||
>d1.polymorphic = b2.polymorphic : (this: Base2) => number
|
||||
>d1.polymorphic : (this: Derived1) => number
|
||||
>d1 : Derived1
|
||||
>implicit : (this: Derived1) => number
|
||||
>b2.implicit : (this: Base2) => number
|
||||
>polymorphic : (this: Derived1) => number
|
||||
>b2.polymorphic : (this: Base2) => number
|
||||
>b2 : Base2
|
||||
>implicit : (this: Base2) => number
|
||||
>polymorphic : (this: Base2) => number
|
||||
|
||||
d2.implicit = d1.explicit // ok, 'y' in { x, y } (c assignable to f)
|
||||
>d2.implicit = d1.explicit : (this: Base1) => number
|
||||
>d2.implicit : (this: Derived2) => number
|
||||
d2.polymorphic = d1.explicit // ok, 'y' in { x, y }
|
||||
>d2.polymorphic = d1.explicit : (this: Base1) => number
|
||||
>d2.polymorphic : (this: Derived2) => number
|
||||
>d2 : Derived2
|
||||
>implicit : (this: Derived2) => number
|
||||
>polymorphic : (this: Derived2) => number
|
||||
>d1.explicit : (this: Base1) => number
|
||||
>d1 : Derived1
|
||||
>explicit : (this: Base1) => number
|
||||
|
||||
b1.implicit = d2.implicit // ok, 'x' and 'y' not in C: { x } (c assignable to f)
|
||||
>b1.implicit = d2.implicit : (this: Derived2) => number
|
||||
>b1.implicit : (this: Base1) => number
|
||||
b1.polymorphic = d2.polymorphic // ok, 'x' and 'y' not in Base1: { x }
|
||||
>b1.polymorphic = d2.polymorphic : (this: Derived2) => number
|
||||
>b1.polymorphic : (this: Base1) => number
|
||||
>b1 : Base1
|
||||
>implicit : (this: Base1) => number
|
||||
>d2.implicit : (this: Derived2) => number
|
||||
>polymorphic : (this: Base1) => number
|
||||
>d2.polymorphic : (this: Derived2) => number
|
||||
>d2 : Derived2
|
||||
>implicit : (this: Derived2) => number
|
||||
>polymorphic : (this: Derived2) => number
|
||||
|
||||
b1.explicit = d2.implicit // ok, 'x' and 'y' not in C: { x } (c assignable to f)
|
||||
>b1.explicit = d2.implicit : (this: Derived2) => number
|
||||
b1.explicit = d2.polymorphic // ok, 'x' and 'y' not in Base1: { x }
|
||||
>b1.explicit = d2.polymorphic : (this: Derived2) => number
|
||||
>b1.explicit : (this: Base1) => number
|
||||
>b1 : Base1
|
||||
>explicit : (this: Base1) => number
|
||||
>d2.implicit : (this: Derived2) => number
|
||||
>d2.polymorphic : (this: Derived2) => number
|
||||
>d2 : Derived2
|
||||
>implicit : (this: Derived2) => number
|
||||
>polymorphic : (this: Derived2) => number
|
||||
|
||||
////// use this-type for construction with new ////
|
||||
function InterfaceThis(this: I) {
|
||||
@ -1005,16 +911,16 @@ let anyThis = new AnyThis();
|
||||
|
||||
//// type parameter inference ////
|
||||
declare var f: {
|
||||
>f : { (this: void, x: number): number; call<U>(this: (this: void, ...argArray: any[]) => U, ...argArray: any[]): U; }
|
||||
>f : { (this: void, x: number): number; call<U>(this: (...argArray: any[]) => U, ...argArray: any[]): U; }
|
||||
|
||||
(this: void, x: number): number,
|
||||
>this : void
|
||||
>x : number
|
||||
|
||||
call<U>(this: (...argArray: any[]) => U, ...argArray: any[]): U;
|
||||
>call : <U>(this: (this: void, ...argArray: any[]) => U, ...argArray: any[]) => U
|
||||
>call : <U>(this: (...argArray: any[]) => U, ...argArray: any[]) => U
|
||||
>U : U
|
||||
>this : (this: void, ...argArray: any[]) => U
|
||||
>this : (...argArray: any[]) => U
|
||||
>argArray : any[]
|
||||
>U : U
|
||||
>argArray : any[]
|
||||
@ -1024,14 +930,18 @@ declare var f: {
|
||||
let n: number = f.call(12);
|
||||
>n : number
|
||||
>f.call(12) : number
|
||||
>f.call : <U>(this: (this: void, ...argArray: any[]) => U, ...argArray: any[]) => U
|
||||
>f : { (this: void, x: number): number; call<U>(this: (this: void, ...argArray: any[]) => U, ...argArray: any[]): U; }
|
||||
>call : <U>(this: (this: void, ...argArray: any[]) => U, ...argArray: any[]) => U
|
||||
>f.call : <U>(this: (...argArray: any[]) => U, ...argArray: any[]) => U
|
||||
>f : { (this: void, x: number): number; call<U>(this: (...argArray: any[]) => U, ...argArray: any[]): U; }
|
||||
>call : <U>(this: (...argArray: any[]) => U, ...argArray: any[]) => U
|
||||
>12 : number
|
||||
|
||||
function missingTypeIsImplicitAny(this, a: number) { return a; }
|
||||
>missingTypeIsImplicitAny : (this: any, a: number) => number
|
||||
function missingTypeIsImplicitAny(this, a: number) { return this.anything + a; }
|
||||
>missingTypeIsImplicitAny : (this: any, a: number) => any
|
||||
>this : any
|
||||
>a : number
|
||||
>this.anything + a : any
|
||||
>this.anything : any
|
||||
>this : any
|
||||
>anything : any
|
||||
>a : number
|
||||
|
||||
|
||||
@ -1,126 +1,103 @@
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(16,15): error TS2339: Property 'n' does not exist on type 'void'.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(44,21): error TS2339: Property 'a' does not exist on type 'void'.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(55,49): error TS2339: Property 'a' does not exist on type 'void'.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(58,1): error TS2345: Argument of type 'void' is not assignable to parameter of type '{ a: number; }'.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(60,1): error TS2345: Argument of type 'void' is not assignable to parameter of type 'I'.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(62,1): error TS2345: Argument of type 'void' is not assignable to parameter of type 'I'.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(67,21): error TS2339: Property 'notFound' does not exist on type '{ y: number; }'.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(70,21): error TS2339: Property 'notSpecified' does not exist on type 'void'.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(74,21): error TS2339: Property 'notSpecified' does not exist on type 'void'.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(76,79): error TS2322: Type '{ y: number; explicitStructural: (this: { y: number; }, x: number) => number; }' is not assignable to type '{ y: number; f: (this: { y: number; }, x: number) => number; }'.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(39,21): error TS2339: Property 'a' does not exist on type 'void'.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(49,1): error TS2345: Argument of type 'void' is not assignable to parameter of type '{ a: number; }'.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(51,1): error TS2345: Argument of type 'void' is not assignable to parameter of type 'I'.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(56,21): error TS2339: Property 'notFound' does not exist on type '{ y: number; }'.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(59,21): error TS2339: Property 'notSpecified' does not exist on type 'void'.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(61,79): error TS2322: Type '{ y: number; explicitStructural: (this: { y: number; }, x: number) => number; }' is not assignable to type '{ y: number; f: (this: { y: number; }, x: number) => number; }'.
|
||||
Object literal may only specify known properties, and 'explicitStructural' does not exist in type '{ y: number; f: (this: { y: number; }, x: number) => number; }'.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(77,97): error TS2322: Type '{ y: string; explicitStructural: (this: { y: number; }, x: number) => number; }' is not assignable to type '{ y: string; f: (this: { y: number; }, x: number) => number; }'.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(62,97): error TS2322: Type '{ y: string; explicitStructural: (this: { y: number; }, x: number) => number; }' is not assignable to type '{ y: string; f: (this: { y: number; }, x: number) => number; }'.
|
||||
Object literal may only specify known properties, and 'explicitStructural' does not exist in type '{ y: string; f: (this: { y: number; }, x: number) => number; }'.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(78,110): error TS2322: Type '{ wrongName: number; explicitStructural: (this: { y: number; }, x: number) => number; }' is not assignable to type '{ wrongName: number; f: (this: { y: number; }, x: number) => number; }'.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(63,110): error TS2322: Type '{ wrongName: number; explicitStructural: (this: { y: number; }, x: number) => number; }' is not assignable to type '{ wrongName: number; f: (this: { y: number; }, x: number) => number; }'.
|
||||
Object literal may only specify known properties, and 'explicitStructural' does not exist in type '{ wrongName: number; f: (this: { y: number; }, x: number) => number; }'.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(80,1): error TS2346: Supplied parameters do not match any signature of call target.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(81,6): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(82,1): error TS2346: Supplied parameters do not match any signature of call target.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(83,1): error TS2345: Argument of type '{ y: string; f: (this: { y: number; }, x: number) => number; }' is not assignable to parameter of type '{ y: number; }'.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(65,1): error TS2346: Supplied parameters do not match any signature of call target.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(66,6): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(67,1): error TS2346: Supplied parameters do not match any signature of call target.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(68,1): error TS2345: Argument of type '{ y: string; f: (this: { y: number; }, x: number) => number; }' is not assignable to parameter of type '{ y: number; }'.
|
||||
Types of property 'y' are incompatible.
|
||||
Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(84,1): error TS2345: Argument of type '{ wrongName: number; f: (this: { y: number; }, x: number) => number; }' is not assignable to parameter of type '{ y: number; }'.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(69,1): error TS2345: Argument of type '{ wrongName: number; f: (this: { y: number; }, x: number) => number; }' is not assignable to parameter of type '{ y: number; }'.
|
||||
Property 'y' is missing in type '{ wrongName: number; f: (this: { y: number; }, x: number) => number; }'.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(87,1): error TS2346: Supplied parameters do not match any signature of call target.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(88,13): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(89,1): error TS2346: Supplied parameters do not match any signature of call target.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(90,1): error TS2346: Supplied parameters do not match any signature of call target.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(91,16): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(92,1): error TS2346: Supplied parameters do not match any signature of call target.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(93,1): error TS2346: Supplied parameters do not match any signature of call target.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(94,16): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(95,1): error TS2346: Supplied parameters do not match any signature of call target.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(96,1): error TS2346: Supplied parameters do not match any signature of call target.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(97,20): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(98,1): error TS2346: Supplied parameters do not match any signature of call target.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(101,5): error TS2322: Type '(this: { y: number; }, x: number) => number' is not assignable to type '(this: void, x: number) => number'.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(72,1): error TS2346: Supplied parameters do not match any signature of call target.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(73,13): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(74,1): error TS2346: Supplied parameters do not match any signature of call target.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(75,1): error TS2346: Supplied parameters do not match any signature of call target.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(76,16): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(77,1): error TS2346: Supplied parameters do not match any signature of call target.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(78,1): error TS2346: Supplied parameters do not match any signature of call target.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(79,16): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(80,1): error TS2346: Supplied parameters do not match any signature of call target.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(81,1): error TS2346: Supplied parameters do not match any signature of call target.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(82,20): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(83,1): error TS2346: Supplied parameters do not match any signature of call target.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(86,5): error TS2322: Type '(this: { y: number; }, x: number) => number' is not assignable to type '(this: void, x: number) => number'.
|
||||
Types of parameters 'this' and 'this' are incompatible.
|
||||
Type 'void' is not assignable to type '{ y: number; }'.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(124,1): error TS2322: Type '(this: D, m: number) => number' is not assignable to type '(this: C, m: number) => number'.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(107,1): error TS2322: Type '(this: D, m: number) => number' is not assignable to type '(this: C, m: number) => number'.
|
||||
Types of parameters 'this' and 'this' are incompatible.
|
||||
Type 'C' is not assignable to type 'D'.
|
||||
Property 'x' is missing in type 'C'.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(125,1): error TS2322: Type '(this: { x: number; }, m: number) => number' is not assignable to type '(this: { n: number; }, m: number) => number'.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(108,1): error TS2322: Type '(this: { x: number; }, m: number) => number' is not assignable to type '(this: { n: number; }, m: number) => number'.
|
||||
Types of parameters 'this' and 'this' are incompatible.
|
||||
Type '{ n: number; }' is not assignable to type '{ x: number; }'.
|
||||
Property 'x' is missing in type '{ n: number; }'.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(127,1): error TS2322: Type '(this: D, m: number) => number' is not assignable to type '(this: C, m: number) => number'.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(110,1): error TS2322: Type '(this: D, m: number) => number' is not assignable to type '(this: C, m: number) => number'.
|
||||
Types of parameters 'this' and 'this' are incompatible.
|
||||
Type 'C' is not assignable to type 'D'.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(128,1): error TS2322: Type '(this: D, m: number) => number' is not assignable to type '(this: C, m: number) => number'.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(111,1): error TS2322: Type '(this: D, m: number) => number' is not assignable to type '(this: C, m: number) => number'.
|
||||
Types of parameters 'this' and 'this' are incompatible.
|
||||
Type 'C' is not assignable to type 'D'.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(129,1): error TS2322: Type '(this: D, m: number) => number' is not assignable to type '(this: C, m: number) => number'.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(112,1): error TS2322: Type '(this: D, m: number) => number' is not assignable to type '(this: C, m: number) => number'.
|
||||
Types of parameters 'this' and 'this' are incompatible.
|
||||
Type 'C' is not assignable to type 'D'.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(130,1): error TS2322: Type '(this: D, m: number) => number' is not assignable to type '(this: C, m: number) => number'.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(113,1): error TS2322: Type '(this: D, m: number) => number' is not assignable to type '(this: C, m: number) => number'.
|
||||
Types of parameters 'this' and 'this' are incompatible.
|
||||
Type 'C' is not assignable to type 'D'.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(131,1): error TS2322: Type '(this: D, m: number) => number' is not assignable to type '(this: C, m: number) => number'.
|
||||
Types of parameters 'this' and 'this' are incompatible.
|
||||
Type 'C' is not assignable to type 'D'.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(132,1): error TS2322: Type '(this: D, m: number) => number' is not assignable to type '(this: C, m: number) => number'.
|
||||
Types of parameters 'this' and 'this' are incompatible.
|
||||
Type 'C' is not assignable to type 'D'.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(133,1): error TS2322: Type '(this: D, m: number) => number' is not assignable to type '(this: { n: number; }, m: number) => number'.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(114,1): error TS2322: Type '(this: D, m: number) => number' is not assignable to type '(this: { n: number; }, m: number) => number'.
|
||||
Types of parameters 'this' and 'this' are incompatible.
|
||||
Type '{ n: number; }' is not assignable to type 'D'.
|
||||
Property 'x' is missing in type '{ n: number; }'.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(134,1): error TS2322: Type '(this: D, m: number) => number' is not assignable to type '(this: { n: number; }, m: number) => number'.
|
||||
Types of parameters 'this' and 'this' are incompatible.
|
||||
Type '{ n: number; }' is not assignable to type 'D'.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(135,1): error TS2322: Type '(this: D, m: number) => number' is not assignable to type '(this: C, m: number) => number'.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(136,1): error TS2322: Type '(this: D, m: number) => number' is not assignable to type '(this: void, m: number) => number'.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(115,1): error TS2322: Type '(this: D, m: number) => number' is not assignable to type '(this: C, m: number) => number'.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(116,1): error TS2322: Type '(this: D, m: number) => number' is not assignable to type '(this: void, m: number) => number'.
|
||||
Types of parameters 'this' and 'this' are incompatible.
|
||||
Type 'void' is not assignable to type 'D'.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(137,1): error TS2322: Type '(this: D, m: number) => number' is not assignable to type '(this: void, m: number) => number'.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(117,1): error TS2322: Type '(this: D, m: number) => number' is not assignable to type '(this: void, m: number) => number'.
|
||||
Types of parameters 'this' and 'this' are incompatible.
|
||||
Type 'void' is not assignable to type 'D'.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(138,1): error TS2322: Type '(this: D, m: number) => number' is not assignable to type '(this: void, m: number) => number'.
|
||||
Types of parameters 'this' and 'this' are incompatible.
|
||||
Type 'void' is not assignable to type 'D'.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(146,51): error TS2339: Property 'x' does not exist on type 'typeof Base1'.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(147,69): error TS2339: Property 'x' does not exist on type 'typeof Base1'.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(167,1): error TS2322: Type '(this: Base2) => number' is not assignable to type '(this: Base1) => number'.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(125,69): error TS2339: Property 'x' does not exist on type 'typeof Base1'.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(145,1): error TS2322: Type '(this: Base2) => number' is not assignable to type '(this: Base1) => number'.
|
||||
Types of parameters 'this' and 'this' are incompatible.
|
||||
Type 'Base1' is not assignable to type 'Base2'.
|
||||
Property 'y' is missing in type 'Base1'.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(168,1): error TS2322: Type '(this: Base2) => number' is not assignable to type '(this: Base1) => number'.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(146,1): error TS2322: Type '(this: Base2) => number' is not assignable to type '(this: Base1) => number'.
|
||||
Types of parameters 'this' and 'this' are incompatible.
|
||||
Type 'Base1' is not assignable to type 'Base2'.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(170,1): error TS2322: Type '(this: Base2) => number' is not assignable to type '(this: Base1) => number'.
|
||||
Types of parameters 'this' and 'this' are incompatible.
|
||||
Type 'Base1' is not assignable to type 'Base2'.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(179,16): error TS2678: A function that is called with the 'new' keyword cannot have a 'this' type that is void.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(180,24): error TS2678: A function that is called with the 'new' keyword cannot have a 'this' type that is void.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(184,17): error TS2680: A constructor cannot have a 'this' parameter.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(187,30): error TS2679: 'this' parameter must be the first parameter.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(187,61): error TS2339: Property 'n' does not exist on type 'void'.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(190,26): error TS1003: Identifier expected.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(190,30): error TS1005: ',' expected.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(190,57): error TS2339: Property 'n' does not exist on type 'void'.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(191,20): error TS2370: A rest parameter must be of an array type.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(191,23): error TS1003: Identifier expected.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(191,27): error TS1005: ',' expected.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(191,54): error TS2339: Property 'n' does not exist on type 'void'.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(192,23): error TS1005: ',' expected.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(192,24): error TS1138: Parameter declaration expected.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(193,28): error TS1003: Identifier expected.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(193,32): error TS1005: ',' expected.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(193,59): error TS2339: Property 'n' does not exist on type 'void'.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(194,30): error TS1005: ',' expected.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(194,32): error TS1138: Parameter declaration expected.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(194,39): error TS1005: ';' expected.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(194,40): error TS1128: Declaration or statement expected.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(194,42): error TS2304: Cannot find name 'number'.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(194,49): error TS1005: ';' expected.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(197,1): error TS7027: Unreachable code detected.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(197,29): error TS2304: Cannot find name 'm'.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(197,32): error TS1005: ';' expected.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(197,35): error TS2304: Cannot find name 'm'.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(148,1): error TS2322: Type '(this: Base2) => number' is not assignable to type '(this: Base1) => number'.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(154,16): error TS2678: A function that is called with the 'new' keyword cannot have a 'this' type that is void.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(158,17): error TS2680: A constructor cannot have a 'this' parameter.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(161,30): error TS2679: 'this' parameter must be the first parameter.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(164,26): error TS1003: Identifier expected.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(164,30): error TS1005: ',' expected.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(165,20): error TS2370: A rest parameter must be of an array type.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(165,23): error TS1003: Identifier expected.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(165,27): error TS1005: ',' expected.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(166,23): error TS1005: ',' expected.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(166,24): error TS1138: Parameter declaration expected.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(167,28): error TS1003: Identifier expected.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(167,32): error TS1005: ',' expected.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(168,30): error TS1005: ',' expected.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(168,32): error TS1138: Parameter declaration expected.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(168,39): error TS1005: ';' expected.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(168,40): error TS1128: Declaration or statement expected.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(168,42): error TS2304: Cannot find name 'number'.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(168,49): error TS1005: ';' expected.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(171,1): error TS7027: Unreachable code detected.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(171,29): error TS2304: Cannot find name 'm'.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(171,32): error TS1005: ';' expected.
|
||||
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(171,35): error TS2304: Cannot find name 'm'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts (76 errors) ====
|
||||
==== tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts (63 errors) ====
|
||||
class C {
|
||||
n: number;
|
||||
explicitThis(this: this, m: number): number {
|
||||
@ -149,9 +126,6 @@ tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(197,35): e
|
||||
explicitD(this: D, m: number): number {
|
||||
return this.x + m;
|
||||
}
|
||||
implicitD(m: number): number {
|
||||
return this.x + m;
|
||||
}
|
||||
}
|
||||
interface I {
|
||||
a: number;
|
||||
@ -160,8 +134,6 @@ tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(197,35): e
|
||||
explicitStructural(this: {a: number}): number;
|
||||
explicitInterface(this: I): number;
|
||||
explicitThis(this: this): number; // TODO: Allow `this` types for interfaces
|
||||
implicitMethod(): number;
|
||||
implicitFunction: () => number;
|
||||
}
|
||||
let impl: I = {
|
||||
a: 12,
|
||||
@ -176,12 +148,6 @@ tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(197,35): e
|
||||
explicitThis() {
|
||||
return this.a;
|
||||
},
|
||||
implicitMethod() {
|
||||
return this.a; // ok, I.a: number
|
||||
},
|
||||
implicitFunction: function () { return this.a; } // TODO: error 'a' not found in 'void'
|
||||
~
|
||||
!!! error TS2339: Property 'a' does not exist on type 'void'.
|
||||
}
|
||||
let implExplicitStructural = impl.explicitStructural;
|
||||
implExplicitStructural(); // error, no 'a' in 'void'
|
||||
@ -190,10 +156,6 @@ tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(197,35): e
|
||||
let implExplicitInterface = impl.explicitInterface;
|
||||
implExplicitInterface(); // error, no 'a' in 'void'
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type 'void' is not assignable to parameter of type 'I'.
|
||||
let implImplicitMethod = impl.implicitMethod;
|
||||
implImplicitMethod(); // error, no 'a' in 'void'
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2345: Argument of type 'void' is not assignable to parameter of type 'I'.
|
||||
function explicitStructural(this: { y: number }, x: number): number {
|
||||
return x + this.y;
|
||||
@ -206,12 +168,6 @@ tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(197,35): e
|
||||
function voidThisSpecified(this: void, x: number): number {
|
||||
return x + this.notSpecified;
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS2339: Property 'notSpecified' does not exist on type 'void'.
|
||||
}
|
||||
function noThisSpecified(x: number): number {
|
||||
// this:void unless loose-this is on
|
||||
return x + this.notSpecified;
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS2339: Property 'notSpecified' does not exist on type 'void'.
|
||||
}
|
||||
let ok: {y: number, f: (this: { y: number }, x: number) => number} = { y: 12, explicitStructural };
|
||||
@ -285,8 +241,8 @@ tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(197,35): e
|
||||
!!! error TS2346: Supplied parameters do not match any signature of call target.
|
||||
|
||||
// oops, this triggers contextual typing, which needs to be updated to understand that =>'s `this` is void.
|
||||
let specifiedToImplicitVoid: (x: number) => number = explicitStructural;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
let specifiedToVoid: (this: void, x: number) => number = explicitStructural;
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! error TS2322: Type '(this: { y: number; }, x: number) => number' is not assignable to type '(this: void, x: number) => number'.
|
||||
!!! error TS2322: Types of parameters 'this' and 'this' are incompatible.
|
||||
!!! error TS2322: Type 'void' is not assignable to type '{ y: number; }'.
|
||||
@ -294,14 +250,12 @@ tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(197,35): e
|
||||
let reconstructed: {
|
||||
n: number,
|
||||
explicitThis(this: C, m: number): number, // note: this: this is not allowed in an object literal type.
|
||||
implicitThis(m: number): number,
|
||||
explicitC(this: C, m: number): number,
|
||||
explicitProperty: (this: {n : number}, m: number) => number,
|
||||
explicitVoid(this: void, m: number): number,
|
||||
} = {
|
||||
n: 12,
|
||||
explicitThis: c.explicitThis,
|
||||
implicitThis: c.implicitThis, // error not assignable -- c.this:c<this> not assignable to this:void.
|
||||
explicitC: c.explicitC,
|
||||
explicitProperty: c.explicitProperty,
|
||||
explicitVoid: c.explicitVoid
|
||||
@ -325,11 +279,6 @@ tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(197,35): e
|
||||
!!! error TS2322: Type '{ n: number; }' is not assignable to type '{ x: number; }'.
|
||||
!!! error TS2322: Property 'x' is missing in type '{ n: number; }'.
|
||||
|
||||
c.explicitC = d.implicitD;
|
||||
~~~~~~~~~~~
|
||||
!!! error TS2322: Type '(this: D, m: number) => number' is not assignable to type '(this: C, m: number) => number'.
|
||||
!!! error TS2322: Types of parameters 'this' and 'this' are incompatible.
|
||||
!!! error TS2322: Type 'C' is not assignable to type 'D'.
|
||||
c.explicitC = d.explicitD;
|
||||
~~~~~~~~~~~
|
||||
!!! error TS2322: Type '(this: D, m: number) => number' is not assignable to type '(this: C, m: number) => number'.
|
||||
@ -339,11 +288,6 @@ tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(197,35): e
|
||||
~~~~~~~~~~~
|
||||
!!! error TS2322: Type '(this: D, m: number) => number' is not assignable to type '(this: C, m: number) => number'.
|
||||
!!! error TS2322: Types of parameters 'this' and 'this' are incompatible.
|
||||
!!! error TS2322: Type 'C' is not assignable to type 'D'.
|
||||
c.explicitThis = d.implicitD;
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS2322: Type '(this: D, m: number) => number' is not assignable to type '(this: C, m: number) => number'.
|
||||
!!! error TS2322: Types of parameters 'this' and 'this' are incompatible.
|
||||
!!! error TS2322: Type 'C' is not assignable to type 'D'.
|
||||
c.explicitThis = d.explicitD;
|
||||
~~~~~~~~~~~~~~
|
||||
@ -361,19 +305,9 @@ tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(197,35): e
|
||||
!!! error TS2322: Types of parameters 'this' and 'this' are incompatible.
|
||||
!!! error TS2322: Type '{ n: number; }' is not assignable to type 'D'.
|
||||
!!! error TS2322: Property 'x' is missing in type '{ n: number; }'.
|
||||
c.explicitProperty = d.implicitD;
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2322: Type '(this: D, m: number) => number' is not assignable to type '(this: { n: number; }, m: number) => number'.
|
||||
!!! error TS2322: Types of parameters 'this' and 'this' are incompatible.
|
||||
!!! error TS2322: Type '{ n: number; }' is not assignable to type 'D'.
|
||||
c.explicitThis = d.explicitThis;
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS2322: Type '(this: D, m: number) => number' is not assignable to type '(this: C, m: number) => number'.
|
||||
c.explicitVoid = d.implicitD;
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS2322: Type '(this: D, m: number) => number' is not assignable to type '(this: void, m: number) => number'.
|
||||
!!! error TS2322: Types of parameters 'this' and 'this' are incompatible.
|
||||
!!! error TS2322: Type 'void' is not assignable to type 'D'.
|
||||
c.explicitVoid = d.explicitD;
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS2322: Type '(this: D, m: number) => number' is not assignable to type '(this: void, m: number) => number'.
|
||||
@ -385,15 +319,12 @@ tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(197,35): e
|
||||
!!! error TS2322: Types of parameters 'this' and 'this' are incompatible.
|
||||
!!! error TS2322: Type 'void' is not assignable to type 'D'.
|
||||
|
||||
/// class-based implicit assignability (with inheritance!) ///
|
||||
/// class-based polymorphic assignability (with inheritance!) ///
|
||||
|
||||
class Base1 {
|
||||
x: number
|
||||
public implicit(): number { return this.x; }
|
||||
public polymorphic(this: this): number { return this.x; }
|
||||
explicit(this: Base1): number { return this.x; }
|
||||
static implicitStatic(): number { return this.x; }
|
||||
~
|
||||
!!! error TS2339: Property 'x' does not exist on type 'typeof Base1'.
|
||||
static explicitStatic(this: typeof Base1): number { return this.x; }
|
||||
~
|
||||
!!! error TS2339: Property 'x' does not exist on type 'typeof Base1'.
|
||||
@ -403,7 +334,7 @@ tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(197,35): e
|
||||
}
|
||||
class Base2 {
|
||||
y: number
|
||||
implicit(): number { return this.y; }
|
||||
polymorphic(this: this): number { return this.y; }
|
||||
explicit(this: Base1): number { return this.x; }
|
||||
}
|
||||
class Derived2 extends Base2 {
|
||||
@ -416,37 +347,29 @@ tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(197,35): e
|
||||
let b2 = new Base2();
|
||||
let d2 = new Derived2();
|
||||
|
||||
b1.implicit = b2.implicit // error, 'this.y' not in C: { x } (c assignable to e)
|
||||
~~~~~~~~~~~
|
||||
b1.polymorphic = b2.polymorphic // error, 'this.y' not in Base1: { x }
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS2322: Type '(this: Base2) => number' is not assignable to type '(this: Base1) => number'.
|
||||
!!! error TS2322: Types of parameters 'this' and 'this' are incompatible.
|
||||
!!! error TS2322: Type 'Base1' is not assignable to type 'Base2'.
|
||||
!!! error TS2322: Property 'y' is missing in type 'Base1'.
|
||||
b1.explicit = b2.implicit // error, 'y' not in C: { x } (c assignable to e)
|
||||
b1.explicit = b2.polymorphic // error, 'y' not in Base1: { x }
|
||||
~~~~~~~~~~~
|
||||
!!! error TS2322: Type '(this: Base2) => number' is not assignable to type '(this: Base1) => number'.
|
||||
!!! error TS2322: Types of parameters 'this' and 'this' are incompatible.
|
||||
!!! error TS2322: Type 'Base1' is not assignable to type 'Base2'.
|
||||
|
||||
d1.explicit = b2.implicit // error, 'y' not in C: { x } (c assignable to e)
|
||||
d1.explicit = b2.polymorphic // error, 'y' not in Base1: { x }
|
||||
~~~~~~~~~~~
|
||||
!!! error TS2322: Type '(this: Base2) => number' is not assignable to type '(this: Base1) => number'.
|
||||
!!! error TS2322: Types of parameters 'this' and 'this' are incompatible.
|
||||
!!! error TS2322: Type 'Base1' is not assignable to type 'Base2'.
|
||||
|
||||
////// use this-type for construction with new ////
|
||||
function VoidThis(this: void) {
|
||||
|
||||
}
|
||||
function ImplicitVoidThis() {
|
||||
|
||||
}
|
||||
let voidThis = new VoidThis();
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS2678: A function that is called with the 'new' keyword cannot have a 'this' type that is void.
|
||||
let implicitVoidThis = new ImplicitVoidThis();
|
||||
~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2678: A function that is called with the 'new' keyword cannot have a 'this' type that is void.
|
||||
|
||||
///// syntax-ish errors /////
|
||||
class ThisConstructor {
|
||||
@ -458,8 +381,6 @@ tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(197,35): e
|
||||
function notFirst(a: number, this: C): number { return this.n; }
|
||||
~~~~~~~
|
||||
!!! error TS2679: 'this' parameter must be the first parameter.
|
||||
~
|
||||
!!! error TS2339: Property 'n' does not exist on type 'void'.
|
||||
|
||||
///// parse errors /////
|
||||
function modifiers(async this: C): number { return this.n; }
|
||||
@ -467,8 +388,6 @@ tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(197,35): e
|
||||
!!! error TS1003: Identifier expected.
|
||||
~
|
||||
!!! error TS1005: ',' expected.
|
||||
~
|
||||
!!! error TS2339: Property 'n' does not exist on type 'void'.
|
||||
function restParam(...this: C): number { return this.n; }
|
||||
~~~~~~~
|
||||
!!! error TS2370: A rest parameter must be of an array type.
|
||||
@ -476,8 +395,6 @@ tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(197,35): e
|
||||
!!! error TS1003: Identifier expected.
|
||||
~
|
||||
!!! error TS1005: ',' expected.
|
||||
~
|
||||
!!! error TS2339: Property 'n' does not exist on type 'void'.
|
||||
function optional(this?: C): number { return this.n; }
|
||||
~
|
||||
!!! error TS1005: ',' expected.
|
||||
@ -488,8 +405,6 @@ tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(197,35): e
|
||||
!!! error TS1003: Identifier expected.
|
||||
~
|
||||
!!! error TS1005: ',' expected.
|
||||
~
|
||||
!!! error TS2339: Property 'n' does not exist on type 'void'.
|
||||
function initializer(this: C = new C()): number { return this.n; }
|
||||
~
|
||||
!!! error TS1005: ',' expected.
|
||||
|
||||
@ -25,9 +25,6 @@ class D {
|
||||
explicitD(this: D, m: number): number {
|
||||
return this.x + m;
|
||||
}
|
||||
implicitD(m: number): number {
|
||||
return this.x + m;
|
||||
}
|
||||
}
|
||||
interface I {
|
||||
a: number;
|
||||
@ -36,8 +33,6 @@ interface I {
|
||||
explicitStructural(this: {a: number}): number;
|
||||
explicitInterface(this: I): number;
|
||||
explicitThis(this: this): number; // TODO: Allow `this` types for interfaces
|
||||
implicitMethod(): number;
|
||||
implicitFunction: () => number;
|
||||
}
|
||||
let impl: I = {
|
||||
a: 12,
|
||||
@ -50,17 +45,11 @@ let impl: I = {
|
||||
explicitThis() {
|
||||
return this.a;
|
||||
},
|
||||
implicitMethod() {
|
||||
return this.a; // ok, I.a: number
|
||||
},
|
||||
implicitFunction: function () { return this.a; } // TODO: error 'a' not found in 'void'
|
||||
}
|
||||
let implExplicitStructural = impl.explicitStructural;
|
||||
implExplicitStructural(); // error, no 'a' in 'void'
|
||||
let implExplicitInterface = impl.explicitInterface;
|
||||
implExplicitInterface(); // error, no 'a' in 'void'
|
||||
let implImplicitMethod = impl.implicitMethod;
|
||||
implImplicitMethod(); // error, no 'a' in 'void'
|
||||
function explicitStructural(this: { y: number }, x: number): number {
|
||||
return x + this.y;
|
||||
}
|
||||
@ -70,10 +59,6 @@ function propertyName(this: { y: number }, x: number): number {
|
||||
function voidThisSpecified(this: void, x: number): number {
|
||||
return x + this.notSpecified;
|
||||
}
|
||||
function noThisSpecified(x: number): number {
|
||||
// this:void unless loose-this is on
|
||||
return x + this.notSpecified;
|
||||
}
|
||||
let ok: {y: number, f: (this: { y: number }, x: number) => number} = { y: 12, explicitStructural };
|
||||
let wrongPropertyType: {y: string, f: (this: { y: number }, x: number) => number} = { y: 'foo', explicitStructural };
|
||||
let wrongPropertyName: {wrongName: number, f: (this: { y: number }, x: number) => number} = { wrongName: 12, explicitStructural };
|
||||
@ -99,19 +84,17 @@ c.explicitProperty('wrong type 3');
|
||||
c.explicitProperty(15, 'too many arguments 3');
|
||||
|
||||
// oops, this triggers contextual typing, which needs to be updated to understand that =>'s `this` is void.
|
||||
let specifiedToImplicitVoid: (x: number) => number = explicitStructural;
|
||||
let specifiedToVoid: (this: void, x: number) => number = explicitStructural;
|
||||
|
||||
let reconstructed: {
|
||||
n: number,
|
||||
explicitThis(this: C, m: number): number, // note: this: this is not allowed in an object literal type.
|
||||
implicitThis(m: number): number,
|
||||
explicitC(this: C, m: number): number,
|
||||
explicitProperty: (this: {n : number}, m: number) => number,
|
||||
explicitVoid(this: void, m: number): number,
|
||||
} = {
|
||||
n: 12,
|
||||
explicitThis: c.explicitThis,
|
||||
implicitThis: c.implicitThis, // error not assignable -- c.this:c<this> not assignable to this:void.
|
||||
explicitC: c.explicitC,
|
||||
explicitProperty: c.explicitProperty,
|
||||
explicitVoid: c.explicitVoid
|
||||
@ -125,26 +108,21 @@ let explicitXProperty: (this: { x: number }, m: number) => number;
|
||||
c.explicitC = function(this: D, m: number) { return this.x + m };
|
||||
c.explicitProperty = explicitXProperty;
|
||||
|
||||
c.explicitC = d.implicitD;
|
||||
c.explicitC = d.explicitD;
|
||||
c.explicitC = d.explicitThis;
|
||||
c.explicitThis = d.implicitD;
|
||||
c.explicitThis = d.explicitD;
|
||||
c.explicitThis = d.explicitThis;
|
||||
c.explicitProperty = d.explicitD;
|
||||
c.explicitProperty = d.implicitD;
|
||||
c.explicitThis = d.explicitThis;
|
||||
c.explicitVoid = d.implicitD;
|
||||
c.explicitVoid = d.explicitD;
|
||||
c.explicitVoid = d.explicitThis;
|
||||
|
||||
/// class-based implicit assignability (with inheritance!) ///
|
||||
/// class-based polymorphic assignability (with inheritance!) ///
|
||||
|
||||
class Base1 {
|
||||
x: number
|
||||
public implicit(): number { return this.x; }
|
||||
public polymorphic(this: this): number { return this.x; }
|
||||
explicit(this: Base1): number { return this.x; }
|
||||
static implicitStatic(): number { return this.x; }
|
||||
static explicitStatic(this: typeof Base1): number { return this.x; }
|
||||
}
|
||||
class Derived1 extends Base1 {
|
||||
@ -152,7 +130,7 @@ class Derived1 extends Base1 {
|
||||
}
|
||||
class Base2 {
|
||||
y: number
|
||||
implicit(): number { return this.y; }
|
||||
polymorphic(this: this): number { return this.y; }
|
||||
explicit(this: Base1): number { return this.x; }
|
||||
}
|
||||
class Derived2 extends Base2 {
|
||||
@ -165,20 +143,16 @@ let d1 = new Derived1();
|
||||
let b2 = new Base2();
|
||||
let d2 = new Derived2();
|
||||
|
||||
b1.implicit = b2.implicit // error, 'this.y' not in C: { x } (c assignable to e)
|
||||
b1.explicit = b2.implicit // error, 'y' not in C: { x } (c assignable to e)
|
||||
b1.polymorphic = b2.polymorphic // error, 'this.y' not in Base1: { x }
|
||||
b1.explicit = b2.polymorphic // error, 'y' not in Base1: { x }
|
||||
|
||||
d1.explicit = b2.implicit // error, 'y' not in C: { x } (c assignable to e)
|
||||
d1.explicit = b2.polymorphic // error, 'y' not in Base1: { x }
|
||||
|
||||
////// use this-type for construction with new ////
|
||||
function VoidThis(this: void) {
|
||||
|
||||
}
|
||||
function ImplicitVoidThis() {
|
||||
|
||||
}
|
||||
let voidThis = new VoidThis();
|
||||
let implicitVoidThis = new ImplicitVoidThis();
|
||||
|
||||
///// syntax-ish errors /////
|
||||
class ThisConstructor {
|
||||
@ -234,9 +208,6 @@ var D = (function () {
|
||||
D.prototype.explicitD = function (m) {
|
||||
return this.x + m;
|
||||
};
|
||||
D.prototype.implicitD = function (m) {
|
||||
return this.x + m;
|
||||
};
|
||||
return D;
|
||||
}());
|
||||
var impl = {
|
||||
@ -249,18 +220,12 @@ var impl = {
|
||||
explicitInterface: function () { return 12; },
|
||||
explicitThis: function () {
|
||||
return this.a;
|
||||
},
|
||||
implicitMethod: function () {
|
||||
return this.a; // ok, I.a: number
|
||||
},
|
||||
implicitFunction: function () { return this.a; } // TODO: error 'a' not found in 'void'
|
||||
}
|
||||
};
|
||||
var implExplicitStructural = impl.explicitStructural;
|
||||
implExplicitStructural(); // error, no 'a' in 'void'
|
||||
var implExplicitInterface = impl.explicitInterface;
|
||||
implExplicitInterface(); // error, no 'a' in 'void'
|
||||
var implImplicitMethod = impl.implicitMethod;
|
||||
implImplicitMethod(); // error, no 'a' in 'void'
|
||||
function explicitStructural(x) {
|
||||
return x + this.y;
|
||||
}
|
||||
@ -270,10 +235,6 @@ function propertyName(x) {
|
||||
function voidThisSpecified(x) {
|
||||
return x + this.notSpecified;
|
||||
}
|
||||
function noThisSpecified(x) {
|
||||
// this:void unless loose-this is on
|
||||
return x + this.notSpecified;
|
||||
}
|
||||
var ok = { y: 12, explicitStructural: explicitStructural };
|
||||
var wrongPropertyType = { y: 'foo', explicitStructural: explicitStructural };
|
||||
var wrongPropertyName = { wrongName: 12, explicitStructural: explicitStructural };
|
||||
@ -296,11 +257,10 @@ c.explicitProperty(); // not enough arguments
|
||||
c.explicitProperty('wrong type 3');
|
||||
c.explicitProperty(15, 'too many arguments 3');
|
||||
// oops, this triggers contextual typing, which needs to be updated to understand that =>'s `this` is void.
|
||||
var specifiedToImplicitVoid = explicitStructural;
|
||||
var specifiedToVoid = explicitStructural;
|
||||
var reconstructed = {
|
||||
n: 12,
|
||||
explicitThis: c.explicitThis,
|
||||
implicitThis: c.implicitThis,
|
||||
explicitC: c.explicitC,
|
||||
explicitProperty: c.explicitProperty,
|
||||
explicitVoid: c.explicitVoid
|
||||
@ -312,25 +272,20 @@ var explicitXProperty;
|
||||
// from differing object types
|
||||
c.explicitC = function (m) { return this.x + m; };
|
||||
c.explicitProperty = explicitXProperty;
|
||||
c.explicitC = d.implicitD;
|
||||
c.explicitC = d.explicitD;
|
||||
c.explicitC = d.explicitThis;
|
||||
c.explicitThis = d.implicitD;
|
||||
c.explicitThis = d.explicitD;
|
||||
c.explicitThis = d.explicitThis;
|
||||
c.explicitProperty = d.explicitD;
|
||||
c.explicitProperty = d.implicitD;
|
||||
c.explicitThis = d.explicitThis;
|
||||
c.explicitVoid = d.implicitD;
|
||||
c.explicitVoid = d.explicitD;
|
||||
c.explicitVoid = d.explicitThis;
|
||||
/// class-based implicit assignability (with inheritance!) ///
|
||||
/// class-based polymorphic assignability (with inheritance!) ///
|
||||
var Base1 = (function () {
|
||||
function Base1() {
|
||||
}
|
||||
Base1.prototype.implicit = function () { return this.x; };
|
||||
Base1.prototype.polymorphic = function () { return this.x; };
|
||||
Base1.prototype.explicit = function () { return this.x; };
|
||||
Base1.implicitStatic = function () { return this.x; };
|
||||
Base1.explicitStatic = function () { return this.x; };
|
||||
return Base1;
|
||||
}());
|
||||
@ -344,7 +299,7 @@ var Derived1 = (function (_super) {
|
||||
var Base2 = (function () {
|
||||
function Base2() {
|
||||
}
|
||||
Base2.prototype.implicit = function () { return this.y; };
|
||||
Base2.prototype.polymorphic = function () { return this.y; };
|
||||
Base2.prototype.explicit = function () { return this.x; };
|
||||
return Base2;
|
||||
}());
|
||||
@ -359,16 +314,13 @@ var b1 = new Base1();
|
||||
var d1 = new Derived1();
|
||||
var b2 = new Base2();
|
||||
var d2 = new Derived2();
|
||||
b1.implicit = b2.implicit; // error, 'this.y' not in C: { x } (c assignable to e)
|
||||
b1.explicit = b2.implicit; // error, 'y' not in C: { x } (c assignable to e)
|
||||
d1.explicit = b2.implicit; // error, 'y' not in C: { x } (c assignable to e)
|
||||
b1.polymorphic = b2.polymorphic; // error, 'this.y' not in Base1: { x }
|
||||
b1.explicit = b2.polymorphic; // error, 'y' not in Base1: { x }
|
||||
d1.explicit = b2.polymorphic; // error, 'y' not in Base1: { x }
|
||||
////// use this-type for construction with new ////
|
||||
function VoidThis() {
|
||||
}
|
||||
function ImplicitVoidThis() {
|
||||
}
|
||||
var voidThis = new VoidThis();
|
||||
var implicitVoidThis = new ImplicitVoidThis();
|
||||
///// syntax-ish errors /////
|
||||
var ThisConstructor = (function () {
|
||||
function ThisConstructor(n) {
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
//// [unionThisTypeInFunctions.ts]
|
||||
interface Real {
|
||||
method(n: number): void;
|
||||
method(this: this, n: number): void;
|
||||
data: string;
|
||||
}
|
||||
interface Fake {
|
||||
method(n: number): void;
|
||||
method(this: this, n: number): void;
|
||||
data: number;
|
||||
}
|
||||
function test(r: Real | Fake) {
|
||||
|
||||
@ -2,22 +2,24 @@
|
||||
interface Real {
|
||||
>Real : Symbol(Real, Decl(unionThisTypeInFunctions.ts, 0, 0))
|
||||
|
||||
method(n: number): void;
|
||||
method(this: this, n: number): void;
|
||||
>method : Symbol(method, Decl(unionThisTypeInFunctions.ts, 0, 16))
|
||||
>n : Symbol(n, Decl(unionThisTypeInFunctions.ts, 1, 11))
|
||||
>this : Symbol(this, Decl(unionThisTypeInFunctions.ts, 1, 11))
|
||||
>n : Symbol(n, Decl(unionThisTypeInFunctions.ts, 1, 22))
|
||||
|
||||
data: string;
|
||||
>data : Symbol(data, Decl(unionThisTypeInFunctions.ts, 1, 28))
|
||||
>data : Symbol(data, Decl(unionThisTypeInFunctions.ts, 1, 40))
|
||||
}
|
||||
interface Fake {
|
||||
>Fake : Symbol(Fake, Decl(unionThisTypeInFunctions.ts, 3, 1))
|
||||
|
||||
method(n: number): void;
|
||||
method(this: this, n: number): void;
|
||||
>method : Symbol(method, Decl(unionThisTypeInFunctions.ts, 4, 16))
|
||||
>n : Symbol(n, Decl(unionThisTypeInFunctions.ts, 5, 11))
|
||||
>this : Symbol(this, Decl(unionThisTypeInFunctions.ts, 5, 11))
|
||||
>n : Symbol(n, Decl(unionThisTypeInFunctions.ts, 5, 22))
|
||||
|
||||
data: number;
|
||||
>data : Symbol(data, Decl(unionThisTypeInFunctions.ts, 5, 28))
|
||||
>data : Symbol(data, Decl(unionThisTypeInFunctions.ts, 5, 40))
|
||||
}
|
||||
function test(r: Real | Fake) {
|
||||
>test : Symbol(test, Decl(unionThisTypeInFunctions.ts, 7, 1))
|
||||
|
||||
@ -2,8 +2,9 @@
|
||||
interface Real {
|
||||
>Real : Real
|
||||
|
||||
method(n: number): void;
|
||||
method(this: this, n: number): void;
|
||||
>method : (this: this, n: number) => void
|
||||
>this : this
|
||||
>n : number
|
||||
|
||||
data: string;
|
||||
@ -12,15 +13,16 @@ interface Real {
|
||||
interface Fake {
|
||||
>Fake : Fake
|
||||
|
||||
method(n: number): void;
|
||||
method(this: this, n: number): void;
|
||||
>method : (this: this, n: number) => void
|
||||
>this : this
|
||||
>n : number
|
||||
|
||||
data: number;
|
||||
>data : number
|
||||
}
|
||||
function test(r: Real | Fake) {
|
||||
>test : (this: void, r: Real | Fake) => void
|
||||
>test : (r: Real | Fake) => void
|
||||
>r : Real | Fake
|
||||
>Real : Real
|
||||
>Fake : Fake
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
// @strictThisChecks: true
|
||||
// body checking
|
||||
class B {
|
||||
n: number;
|
||||
@ -8,9 +7,6 @@ class C {
|
||||
explicitThis(this: this, m: number): number {
|
||||
return this.n + m;
|
||||
}
|
||||
implicitThis(m: number): number {
|
||||
return this.n + m;
|
||||
}
|
||||
explicitC(this: C, m: number): number {
|
||||
return this.n + m;
|
||||
}
|
||||
@ -29,8 +25,6 @@ interface I {
|
||||
explicitStructural(this: {a: number}): number;
|
||||
explicitInterface(this: I): number;
|
||||
explicitThis(this: this): number;
|
||||
implicitMethod(): number;
|
||||
implicitFunction: () => number;
|
||||
}
|
||||
function explicitStructural(this: { y: number }, x: number): number {
|
||||
return x + this.y;
|
||||
@ -39,7 +33,7 @@ function justThis(this: { y: number }): number {
|
||||
return this.y;
|
||||
}
|
||||
function implicitThis(n: number): number {
|
||||
return 12;
|
||||
return this.m + n + 12;
|
||||
}
|
||||
let impl: I = {
|
||||
a: 12,
|
||||
@ -54,10 +48,6 @@ let impl: I = {
|
||||
explicitThis() {
|
||||
return this.a;
|
||||
},
|
||||
implicitMethod() {
|
||||
return this.a;
|
||||
},
|
||||
implicitFunction: () => this.a, // ok, this: any because it refers to some outer object (window?)
|
||||
}
|
||||
impl.explicitVoid1 = function () { return 12; };
|
||||
impl.explicitVoid2 = () => 12;
|
||||
@ -66,9 +56,6 @@ impl.explicitInterface = function() { return this.a; };
|
||||
impl.explicitStructural = () => 12;
|
||||
impl.explicitInterface = () => 12;
|
||||
impl.explicitThis = function () { return this.a; };
|
||||
impl.implicitMethod = function () { return this.a; };
|
||||
impl.implicitMethod = () => 12;
|
||||
impl.implicitFunction = () => this.a; // ok, this: any because it refers to some outer object (window?)
|
||||
// parameter checking
|
||||
let ok: {y: number, f: (this: { y: number }, x: number) => number} = { y: 12, f: explicitStructural };
|
||||
let implicitAnyOk: {notSpecified: number, f: (x: number) => number} = { notSpecified: 12, f: implicitThis };
|
||||
@ -82,29 +69,26 @@ let ripped = c.explicitC;
|
||||
c.explicitC(12);
|
||||
c.explicitProperty(12);
|
||||
c.explicitThis(12);
|
||||
c.implicitThis(12);
|
||||
d.explicitC(12);
|
||||
d.explicitProperty(12);
|
||||
d.explicitThis(12);
|
||||
d.implicitThis(12);
|
||||
let reconstructed: {
|
||||
n: number,
|
||||
explicitThis(this: C, m: number): number, // note: this: this is not allowed in an object literal type.
|
||||
implicitThis(m: number): number,
|
||||
explicitC(this: C, m: number): number,
|
||||
explicitProperty: (this: {n : number}, m: number) => number,
|
||||
explicitVoid(this: void, m: number): number,
|
||||
} = {
|
||||
n: 12,
|
||||
explicitThis: c.explicitThis,
|
||||
implicitThis: c.implicitThis,
|
||||
explicitC: c.explicitC,
|
||||
explicitProperty: c.explicitProperty,
|
||||
explicitVoid: c.explicitVoid
|
||||
};
|
||||
reconstructed.explicitThis(10);
|
||||
reconstructed.explicitProperty(11);
|
||||
reconstructed.implicitThis(11);
|
||||
|
||||
let explicitVoid = reconstructed.explicitVoid;
|
||||
explicitVoid(12);
|
||||
// assignment checking
|
||||
let unboundToSpecified: (this: { y: number }, x: number) => number = x => x + this.y; // ok, this:any
|
||||
let specifiedToSpecified: (this: {y: number}, x: number) => number = explicitStructural;
|
||||
@ -143,8 +127,6 @@ c.explicitThis = function(this: C, m: number) { return this.n + m };
|
||||
c.explicitC = function(m) { return this.n + m };
|
||||
c.explicitProperty = function(m) { return this.n + m };
|
||||
c.explicitThis = function(m) { return this.n + m };
|
||||
c.implicitThis = function(m) { return this.n + m };
|
||||
c.implicitThis = reconstructed.implicitThis;
|
||||
|
||||
c.explicitC = function(this: B, m: number) { return this.n + m };
|
||||
|
||||
@ -154,19 +136,17 @@ c.explicitVoid = n => n;
|
||||
// class-based assignability
|
||||
class Base1 {
|
||||
x: number;
|
||||
public implicit(): number { return this.x; }
|
||||
public polymorphic(this: this): number { return this.x; }
|
||||
explicit(this: Base1): number { return this.x; }
|
||||
static implicitStatic(): number { return this.y; }
|
||||
static explicitStatic(this: typeof Base1): number { return this.y; }
|
||||
static y: number;
|
||||
|
||||
}
|
||||
class Derived1 extends Base1 {
|
||||
y: number
|
||||
}
|
||||
class Base2 {
|
||||
y: number
|
||||
implicit(): number { return this.y; }
|
||||
polymorphic(this: this): number { return this.y; }
|
||||
explicit(this: Base1): number { return this.x; }
|
||||
}
|
||||
class Derived2 extends Base2 {
|
||||
@ -176,14 +156,14 @@ let b1 = new Base1();
|
||||
let b2 = new Base2();
|
||||
let d1 = new Derived1();
|
||||
let d2 = new Derived2();
|
||||
d2.implicit = d1.implicit // ok, 'x' and 'y' in { x, y } (d assignable to f and vice versa)
|
||||
d1.implicit = d2.implicit // ok, 'x' and 'y' in { x, y } (f assignable to d and vice versa)
|
||||
d2.polymorphic = d1.polymorphic // ok, 'x' and 'y' in { x, y }
|
||||
d1.polymorphic = d2.polymorphic // ok, 'x' and 'y' in { x, y }
|
||||
|
||||
// bivariance-allowed cases
|
||||
d1.implicit = b2.implicit // ok, 'y' in D: { x, y } (d assignable e)
|
||||
d2.implicit = d1.explicit // ok, 'y' in { x, y } (c assignable to f)
|
||||
b1.implicit = d2.implicit // ok, 'x' and 'y' not in C: { x } (c assignable to f)
|
||||
b1.explicit = d2.implicit // ok, 'x' and 'y' not in C: { x } (c assignable to f)
|
||||
d1.polymorphic = b2.polymorphic // ok, 'y' in D: { x, y }
|
||||
d2.polymorphic = d1.explicit // ok, 'y' in { x, y }
|
||||
b1.polymorphic = d2.polymorphic // ok, 'x' and 'y' not in Base1: { x }
|
||||
b1.explicit = d2.polymorphic // ok, 'x' and 'y' not in Base1: { x }
|
||||
|
||||
////// use this-type for construction with new ////
|
||||
function InterfaceThis(this: I) {
|
||||
@ -206,4 +186,4 @@ declare var f: {
|
||||
};
|
||||
let n: number = f.call(12);
|
||||
|
||||
function missingTypeIsImplicitAny(this, a: number) { return a; }
|
||||
function missingTypeIsImplicitAny(this, a: number) { return this.anything + a; }
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
// @strictThisChecks: true
|
||||
class C {
|
||||
n: number;
|
||||
explicitThis(this: this, m: number): number {
|
||||
@ -25,9 +24,6 @@ class D {
|
||||
explicitD(this: D, m: number): number {
|
||||
return this.x + m;
|
||||
}
|
||||
implicitD(m: number): number {
|
||||
return this.x + m;
|
||||
}
|
||||
}
|
||||
interface I {
|
||||
a: number;
|
||||
@ -36,8 +32,6 @@ interface I {
|
||||
explicitStructural(this: {a: number}): number;
|
||||
explicitInterface(this: I): number;
|
||||
explicitThis(this: this): number; // TODO: Allow `this` types for interfaces
|
||||
implicitMethod(): number;
|
||||
implicitFunction: () => number;
|
||||
}
|
||||
let impl: I = {
|
||||
a: 12,
|
||||
@ -50,17 +44,11 @@ let impl: I = {
|
||||
explicitThis() {
|
||||
return this.a;
|
||||
},
|
||||
implicitMethod() {
|
||||
return this.a; // ok, I.a: number
|
||||
},
|
||||
implicitFunction: function () { return this.a; } // TODO: error 'a' not found in 'void'
|
||||
}
|
||||
let implExplicitStructural = impl.explicitStructural;
|
||||
implExplicitStructural(); // error, no 'a' in 'void'
|
||||
let implExplicitInterface = impl.explicitInterface;
|
||||
implExplicitInterface(); // error, no 'a' in 'void'
|
||||
let implImplicitMethod = impl.implicitMethod;
|
||||
implImplicitMethod(); // error, no 'a' in 'void'
|
||||
function explicitStructural(this: { y: number }, x: number): number {
|
||||
return x + this.y;
|
||||
}
|
||||
@ -70,10 +58,6 @@ function propertyName(this: { y: number }, x: number): number {
|
||||
function voidThisSpecified(this: void, x: number): number {
|
||||
return x + this.notSpecified;
|
||||
}
|
||||
function noThisSpecified(x: number): number {
|
||||
// this:void unless loose-this is on
|
||||
return x + this.notSpecified;
|
||||
}
|
||||
let ok: {y: number, f: (this: { y: number }, x: number) => number} = { y: 12, explicitStructural };
|
||||
let wrongPropertyType: {y: string, f: (this: { y: number }, x: number) => number} = { y: 'foo', explicitStructural };
|
||||
let wrongPropertyName: {wrongName: number, f: (this: { y: number }, x: number) => number} = { wrongName: 12, explicitStructural };
|
||||
@ -99,19 +83,17 @@ c.explicitProperty('wrong type 3');
|
||||
c.explicitProperty(15, 'too many arguments 3');
|
||||
|
||||
// oops, this triggers contextual typing, which needs to be updated to understand that =>'s `this` is void.
|
||||
let specifiedToImplicitVoid: (x: number) => number = explicitStructural;
|
||||
let specifiedToVoid: (this: void, x: number) => number = explicitStructural;
|
||||
|
||||
let reconstructed: {
|
||||
n: number,
|
||||
explicitThis(this: C, m: number): number, // note: this: this is not allowed in an object literal type.
|
||||
implicitThis(m: number): number,
|
||||
explicitC(this: C, m: number): number,
|
||||
explicitProperty: (this: {n : number}, m: number) => number,
|
||||
explicitVoid(this: void, m: number): number,
|
||||
} = {
|
||||
n: 12,
|
||||
explicitThis: c.explicitThis,
|
||||
implicitThis: c.implicitThis, // error not assignable -- c.this:c<this> not assignable to this:void.
|
||||
explicitC: c.explicitC,
|
||||
explicitProperty: c.explicitProperty,
|
||||
explicitVoid: c.explicitVoid
|
||||
@ -125,26 +107,21 @@ let explicitXProperty: (this: { x: number }, m: number) => number;
|
||||
c.explicitC = function(this: D, m: number) { return this.x + m };
|
||||
c.explicitProperty = explicitXProperty;
|
||||
|
||||
c.explicitC = d.implicitD;
|
||||
c.explicitC = d.explicitD;
|
||||
c.explicitC = d.explicitThis;
|
||||
c.explicitThis = d.implicitD;
|
||||
c.explicitThis = d.explicitD;
|
||||
c.explicitThis = d.explicitThis;
|
||||
c.explicitProperty = d.explicitD;
|
||||
c.explicitProperty = d.implicitD;
|
||||
c.explicitThis = d.explicitThis;
|
||||
c.explicitVoid = d.implicitD;
|
||||
c.explicitVoid = d.explicitD;
|
||||
c.explicitVoid = d.explicitThis;
|
||||
|
||||
/// class-based implicit assignability (with inheritance!) ///
|
||||
/// class-based polymorphic assignability (with inheritance!) ///
|
||||
|
||||
class Base1 {
|
||||
x: number
|
||||
public implicit(): number { return this.x; }
|
||||
public polymorphic(this: this): number { return this.x; }
|
||||
explicit(this: Base1): number { return this.x; }
|
||||
static implicitStatic(): number { return this.x; }
|
||||
static explicitStatic(this: typeof Base1): number { return this.x; }
|
||||
}
|
||||
class Derived1 extends Base1 {
|
||||
@ -152,7 +129,7 @@ class Derived1 extends Base1 {
|
||||
}
|
||||
class Base2 {
|
||||
y: number
|
||||
implicit(): number { return this.y; }
|
||||
polymorphic(this: this): number { return this.y; }
|
||||
explicit(this: Base1): number { return this.x; }
|
||||
}
|
||||
class Derived2 extends Base2 {
|
||||
@ -165,20 +142,16 @@ let d1 = new Derived1();
|
||||
let b2 = new Base2();
|
||||
let d2 = new Derived2();
|
||||
|
||||
b1.implicit = b2.implicit // error, 'this.y' not in C: { x } (c assignable to e)
|
||||
b1.explicit = b2.implicit // error, 'y' not in C: { x } (c assignable to e)
|
||||
b1.polymorphic = b2.polymorphic // error, 'this.y' not in Base1: { x }
|
||||
b1.explicit = b2.polymorphic // error, 'y' not in Base1: { x }
|
||||
|
||||
d1.explicit = b2.implicit // error, 'y' not in C: { x } (c assignable to e)
|
||||
d1.explicit = b2.polymorphic // error, 'y' not in Base1: { x }
|
||||
|
||||
////// use this-type for construction with new ////
|
||||
function VoidThis(this: void) {
|
||||
|
||||
}
|
||||
function ImplicitVoidThis() {
|
||||
|
||||
}
|
||||
let voidThis = new VoidThis();
|
||||
let implicitVoidThis = new ImplicitVoidThis();
|
||||
|
||||
///// syntax-ish errors /////
|
||||
class ThisConstructor {
|
||||
|
||||
@ -1,10 +1,9 @@
|
||||
// @strictThisChecks: true
|
||||
interface Real {
|
||||
method(n: number): void;
|
||||
method(this: this, n: number): void;
|
||||
data: string;
|
||||
}
|
||||
interface Fake {
|
||||
method(n: number): void;
|
||||
method(this: this, n: number): void;
|
||||
data: number;
|
||||
}
|
||||
function test(r: Real | Fake) {
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
// @strictThisChecks: true
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
////interface Restricted {
|
||||
@ -7,10 +6,10 @@
|
||||
////class C1 implements Restricted {
|
||||
//// n: number;
|
||||
//// m: number;
|
||||
//// f() {this./*1*/} // test on 'this.'
|
||||
//// f(this: this) {this./*1*/} // test on 'this.'
|
||||
//// g(this: Restricted) {this./*2*/}
|
||||
////}
|
||||
////function f() {this./*3*/}
|
||||
////function f(this: void) {this./*3*/}
|
||||
////function g(this: Restricted) {this./*4*/}
|
||||
|
||||
goTo.marker('1');
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
// @strictThisChecks: true
|
||||
/// <reference path='fourslash.ts' />
|
||||
////interface Restricted {
|
||||
//// n: number;
|
||||
@ -6,9 +5,9 @@
|
||||
////function wrapper(wrapped: { (): void; }) { }
|
||||
////class Foo {
|
||||
//// n: number;
|
||||
//// public implicitThis() {
|
||||
//// public explicitThis(this: this) {
|
||||
//// wrapper(
|
||||
//// function implicitVoid() {
|
||||
//// function explicitVoid(this: void) {
|
||||
//// console.log(th/*1*/is);
|
||||
//// }
|
||||
//// )
|
||||
@ -22,15 +21,15 @@
|
||||
//// }
|
||||
////}
|
||||
////class Bar<T> {
|
||||
//// public implicitThis() {
|
||||
//// public explicitThis(this: this) {
|
||||
//// console.log(th/*7*/is);
|
||||
//// }
|
||||
//// public explicitThis(this: Bar<T>) {
|
||||
//// public explicitClass(this: Bar<T>) {
|
||||
//// console.log(thi/*8*/s);
|
||||
//// }
|
||||
////}
|
||||
////
|
||||
////function implicitVoid(x: number): void {
|
||||
////function implicitAny(x: number): void {
|
||||
//// return th/*9*/is;
|
||||
////}
|
||||
////function explicitVoid(th/*10*/is: void, x: number): void {
|
||||
@ -75,7 +74,7 @@ verify.quickInfoIs('this: this');
|
||||
goTo.marker('8');
|
||||
verify.quickInfoIs('this: Bar<T>');
|
||||
goTo.marker('9');
|
||||
verify.quickInfoIs('void');
|
||||
verify.quickInfoIs('any');
|
||||
goTo.marker('10');
|
||||
verify.quickInfoIs('(parameter) this: void');
|
||||
goTo.marker('11');
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user