mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-11 10:46:28 -05:00
Added the accidentally-ignored js files.
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
//// [declarationEmitIdentifierPredicates01.ts]
|
||||
|
||||
export function f(x: any): x is number {
|
||||
return typeof x === "number";
|
||||
}
|
||||
|
||||
//// [declarationEmitIdentifierPredicates01.js]
|
||||
"use strict";
|
||||
function f(x) {
|
||||
return typeof x === "number";
|
||||
}
|
||||
exports.f = f;
|
||||
|
||||
|
||||
//// [declarationEmitIdentifierPredicates01.d.ts]
|
||||
export declare function f(x: any): x is number;
|
||||
@@ -0,0 +1,16 @@
|
||||
//// [declarationEmitIdentifierPredicatesWithPrivateName01.ts]
|
||||
|
||||
interface I {
|
||||
a: number;
|
||||
}
|
||||
|
||||
export function f(x: any): x is I {
|
||||
return typeof x.a === "number";
|
||||
}
|
||||
|
||||
//// [declarationEmitIdentifierPredicatesWithPrivateName01.js]
|
||||
"use strict";
|
||||
function f(x) {
|
||||
return typeof x.a === "number";
|
||||
}
|
||||
exports.f = f;
|
||||
43
tests/baselines/reference/declarationEmitThisPredicates01.js
Normal file
43
tests/baselines/reference/declarationEmitThisPredicates01.js
Normal file
@@ -0,0 +1,43 @@
|
||||
//// [declarationEmitThisPredicates01.ts]
|
||||
|
||||
export class C {
|
||||
m(): this is D {
|
||||
return this instanceof D;
|
||||
}
|
||||
}
|
||||
|
||||
export class D extends C {
|
||||
}
|
||||
|
||||
//// [declarationEmitThisPredicates01.js]
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
C.prototype.m = function () {
|
||||
return this instanceof D;
|
||||
};
|
||||
return C;
|
||||
}());
|
||||
exports.C = C;
|
||||
var D = (function (_super) {
|
||||
__extends(D, _super);
|
||||
function D() {
|
||||
_super.apply(this, arguments);
|
||||
}
|
||||
return D;
|
||||
}(C));
|
||||
exports.D = D;
|
||||
|
||||
|
||||
//// [declarationEmitThisPredicates01.d.ts]
|
||||
export declare class C {
|
||||
m(): this is D;
|
||||
}
|
||||
export declare class D extends C {
|
||||
}
|
||||
34
tests/baselines/reference/declarationEmitThisPredicates02.js
Normal file
34
tests/baselines/reference/declarationEmitThisPredicates02.js
Normal file
@@ -0,0 +1,34 @@
|
||||
//// [declarationEmitThisPredicates02.ts]
|
||||
|
||||
export interface Foo {
|
||||
a: string;
|
||||
b: number;
|
||||
c: boolean;
|
||||
}
|
||||
|
||||
export const obj = {
|
||||
m(): this is Foo {
|
||||
let dis = this as Foo;
|
||||
return dis.a != null && dis.b != null && dis.c != null;
|
||||
}
|
||||
}
|
||||
|
||||
//// [declarationEmitThisPredicates02.js]
|
||||
"use strict";
|
||||
exports.obj = {
|
||||
m: function () {
|
||||
var dis = this;
|
||||
return dis.a != null && dis.b != null && dis.c != null;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//// [declarationEmitThisPredicates02.d.ts]
|
||||
export interface Foo {
|
||||
a: string;
|
||||
b: number;
|
||||
c: boolean;
|
||||
}
|
||||
export declare const obj: {
|
||||
m(): this is Foo;
|
||||
};
|
||||
@@ -0,0 +1,34 @@
|
||||
//// [declarationEmitThisPredicatesWithPrivateName01.ts]
|
||||
|
||||
export class C {
|
||||
m(): this is D {
|
||||
return this instanceof D;
|
||||
}
|
||||
}
|
||||
|
||||
class D extends C {
|
||||
}
|
||||
|
||||
//// [declarationEmitThisPredicatesWithPrivateName01.js]
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
C.prototype.m = function () {
|
||||
return this instanceof D;
|
||||
};
|
||||
return C;
|
||||
}());
|
||||
exports.C = C;
|
||||
var D = (function (_super) {
|
||||
__extends(D, _super);
|
||||
function D() {
|
||||
_super.apply(this, arguments);
|
||||
}
|
||||
return D;
|
||||
}(C));
|
||||
@@ -0,0 +1,23 @@
|
||||
//// [declarationEmitThisPredicatesWithPrivateName02.ts]
|
||||
|
||||
interface Foo {
|
||||
a: string;
|
||||
b: number;
|
||||
c: boolean;
|
||||
}
|
||||
|
||||
export const obj = {
|
||||
m(): this is Foo {
|
||||
let dis = this as Foo;
|
||||
return dis.a != null && dis.b != null && dis.c != null;
|
||||
}
|
||||
}
|
||||
|
||||
//// [declarationEmitThisPredicatesWithPrivateName02.js]
|
||||
"use strict";
|
||||
exports.obj = {
|
||||
m: function () {
|
||||
var dis = this;
|
||||
return dis.a != null && dis.b != null && dis.c != null;
|
||||
}
|
||||
};
|
||||
26
tests/baselines/reference/typeGuardOfFormFunctionEquality.js
Normal file
26
tests/baselines/reference/typeGuardOfFormFunctionEquality.js
Normal file
@@ -0,0 +1,26 @@
|
||||
//// [typeGuardOfFormFunctionEquality.ts]
|
||||
declare function isString1(a: number, b: Object): b is string;
|
||||
|
||||
declare function isString2(a: Object): a is string;
|
||||
|
||||
switch (isString1(0, "")) {
|
||||
case isString2(""):
|
||||
default:
|
||||
}
|
||||
|
||||
var x = isString1(0, "") === isString2("");
|
||||
|
||||
function isString3(a: number, b: number, c: Object): c is string {
|
||||
return isString1(0, c);
|
||||
}
|
||||
|
||||
|
||||
//// [typeGuardOfFormFunctionEquality.js]
|
||||
switch (isString1(0, "")) {
|
||||
case isString2(""):
|
||||
default:
|
||||
}
|
||||
var x = isString1(0, "") === isString2("");
|
||||
function isString3(a, b, c) {
|
||||
return isString1(0, c);
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
//// [typePredicateOnVariableDeclaration01.ts]
|
||||
|
||||
var x: this is string;
|
||||
|
||||
//// [typePredicateOnVariableDeclaration01.js]
|
||||
var x;
|
||||
|
||||
|
||||
//// [typePredicateOnVariableDeclaration01.d.ts]
|
||||
declare var x: this is string;
|
||||
@@ -0,0 +1,6 @@
|
||||
//// [typePredicateOnVariableDeclaration02.ts]
|
||||
|
||||
var y: z is number;
|
||||
|
||||
//// [typePredicateOnVariableDeclaration02.js]
|
||||
var y = is, number;
|
||||
Reference in New Issue
Block a user