Merge pull request #33452 from DefinitelyTyped/cleanup-this-references

Fix bad this references in tests
This commit is contained in:
Nathan Shively-Sanders
2019-02-28 07:14:54 -08:00
committed by GitHub
28 changed files with 120 additions and 119 deletions

View File

@@ -33,7 +33,7 @@ myApp.config((
$urlMatcherFactory.type("fullType", {
decode: (val) => parseInt(val, 10),
encode: (val) => val && val.toString(),
equals: (a, b) => this.is(a) && a === b,
equals: function (a, b) { return this.is(a) && a === b },
is: (val) => angular.isNumber(val) && isFinite(val) && val % 1 === 0,
pattern: /\d+/
});

View File

@@ -213,7 +213,7 @@ $('ul').undelegate('click', 'li', () => {
$('li').on('click', () => {
$.noop;
});
$('ul').on('click', 'li', () => {
$('ul').on('click', 'li', function() {
console.log($(this).text());
});
$('li').off('click');

View File

@@ -578,7 +578,7 @@ $('#example tbody').on('click', 'td', () => {
const cell_invalidate_1 = cell.invalidate();
const cell_invalidate_2 = cell.invalidate("data");
$('#example tbody').on('click', 'td', () => {
$('#example tbody').on('click', 'td', function() {
this.innerHTML = (parseInt(this.innerHTML, 10) + 1).toString();
dt.cell(this).invalidate().draw();
});
@@ -773,7 +773,7 @@ let column_search_set = column.search("string");
column_search_set = column.search("string", true);
column_search_set = column.search("string", true, false);
column_search_set = column.search("string", true, false, true);
$('#column3_search').on('keyup', () => {
$('#column3_search').on('keyup', function() {
dt
.columns(3)
.search((this as HTMLInputElement).value)

View File

@@ -1,6 +1,6 @@
// transplant from https://github.com/spmason/expectations/blob/695c25bd35bb1751533a8082a5aa378e3e1b381f/test/expect.tests.js
var root = this;
var root = window;
// Stub mocha functions
const {describe, it, before, after, beforeEach, afterEach} = null as any as {
@@ -451,7 +451,7 @@ describe('expect', ()=> {
describe('extensibility', ()=> {
it('allows you to add your own assertions', ()=> {
expect.addAssertion('toBeFoo', ()=> {
expect.addAssertion('toBeFoo', function () {
if (this.value === 'foo') {
return this.pass();
}

View File

@@ -2,7 +2,8 @@
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": false,
@@ -20,4 +21,4 @@
"index.d.ts",
"expectations-tests.ts"
]
}
}

View File

@@ -1,5 +1,5 @@
// Type definitions for expo-localization 1.0
// Project: https://docs.expo.io/
// Project: https://docs.expo.io/versions/latest/sdk/localization
// Definitions by: Bartosz Dotryw <https://github.com/burtek>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped

View File

@@ -2,7 +2,7 @@
// Grid
$(() => {
this.grid = $('#grid').grid({
(this as any).grid = $('#grid').grid({
primaryKey: 'ID',
columns: [
{ field: 'ID', width: 50, sortable: true },
@@ -14,9 +14,9 @@ $(() => {
// Dialog
$(() => {
this.dialog = $('#playerModal').dialog({
(this as any).dialog = $('#playerModal').dialog({
autoOpen: false,
title: 'Player',
width: 400
});
});
});

View File

@@ -52,7 +52,7 @@ console.log(err instanceof Error); // true
// ----------------------------------------
// Advanced usage: creating custom Error subclasses
var Custom404Error = httperr.createHttpError(404, 'Not Found', config => {
var Custom404Error = httperr.createHttpError(404, 'Not Found', function (config) {
this.message = 'The resource was not found';
this['some custom property'] = config.parameters['some custom parameter'];
});

View File

@@ -772,7 +772,7 @@ describe("Jasmine Mock Ajax (for toplevel)", () => {
error = jasmine.createSpy("onFailure");
complete = jasmine.createSpy("onComplete");
onreadystatechange = () => {
onreadystatechange = function() {
if (this.readyState === (this.DONE || 4)) { // IE 8 doesn't support DONE
if (this.status === 200) {
success(this.responseText, this.textStatus, this);

View File

@@ -16,7 +16,7 @@ klaw('/some/dir')
// README.md: Streams 2 & 3 (pull) with error handling
klaw('/some/dir')
.on('readable', () => {
.on('readable', function() {
while (true) {
const item = this.read();
if (!item) break;

View File

@@ -173,7 +173,7 @@ knex.select('title', 'author', 'year').from('books');
knex.select({ name: 'title', writer: 'author' }).from(knex.raw('books'));
knex.select().table('books');
knex.avg('sum_column1').from(() => {
knex.avg('sum_column1').from(function() {
this.sum('column1 as sum_column1').from('t1').groupBy('column1').as('t1');
}).as('ignored_alias');
@@ -190,7 +190,7 @@ knex('users').where({
knex('users').where('id', 1);
knex('users').where(() => {
knex('users').where(function() {
this.where('id', 1).orWhere('id', '>', 10);
}).orWhere({name: 'Tester'});
@@ -218,7 +218,7 @@ knex.select('name').from('users')
knex('users')
.where('name', '=', 'John')
.orWhere(() => {
.orWhere(function() {
this.where('votes', '>', 100).andWhere('title', '<>', 'Admin');
});
@@ -230,13 +230,13 @@ knex('users').whereNull('updated_at');
knex('users').whereNotNull('created_at');
knex('users').whereExists(() => {
knex('users').whereExists(function() {
this.select('*').from('accounts').whereRaw('users.account_id = accounts.id');
});
knex('users').whereExists(knex.select('*').from('accounts').whereRaw('users.account_id = accounts.id'));
knex('users').whereNotExists(() => {
knex('users').whereNotExists(function() {
this.select('*').from('accounts').whereRaw('users.account_id = accounts.id');
});
@@ -321,15 +321,15 @@ knex('users')
.join(knex('contacts').select('user_id', 'phone').as('contacts'), { 'users.id': 'contacts.user_id' })
.select('users.id', 'contacts.phone');
knex.select('*').from('users').join(knex('accounts').select('id', 'owner_id').as('accounts'), () => {
knex.select('*').from('users').join(knex('accounts').select('id', 'owner_id').as('accounts'), function() {
this.on('accounts.id', '=', 'users.account_id').orOn('accounts.owner_id', '=', 'users.id');
});
knex.select('*').from('users').join('accounts', () => {
knex.select('*').from('users').join('accounts', function() {
this.on('accounts.id', '=', 'users.account_id').orOn('accounts.owner_id', '=', 'users.id');
});
knex.select('*').from('users').join('accounts', (join: Knex.JoinClause) => {
knex.select('*').from('users').join('accounts', function(join: Knex.JoinClause) {
if (this !== join) {
throw new Error("join() callback call semantics wrong");
}
@@ -337,120 +337,120 @@ knex.select('*').from('users').join('accounts', (join: Knex.JoinClause) => {
join.on('accounts.id', '=', 'users.account_id').orOn('accounts.owner_id', '=', 'users.id');
});
knex.select('*').from('user').join('contacts', () => {
knex.select('*').from('user').join('contacts', function() {
this.on('users.id', '=', knex.raw(7));
});
knex.select('*').from('users').join('contacts', () => {
knex.select('*').from('users').join('contacts', function() {
this.on('users.id', '=', 'contacts.id').onIn('contacts.id', [7, 15, 23, 41]);
});
knex.select('*').from('users').join('contacts', () => {
knex.select('*').from('users').join('contacts', function() {
this.on('users.id', '=', 'contacts.id').andOnIn('contacts.id', [7, 15, 23, 41]);
});
knex.select('*').from('users').join('contacts', () => {
knex.select('*').from('users').join('contacts', function() {
this.on('users.id', '=', 'contacts.id').orOnIn('contacts.id', [7, 15, 23, 41]);
});
knex.select('*').from('users').join('contacts', () => {
knex.select('*').from('users').join('contacts', function() {
this.on('users.id', '=', 'contacts.id').onNotIn('contacts.id', [7, 15, 23, 41]);
});
knex.select('*').from('users').join('contacts', () => {
knex.select('*').from('users').join('contacts', function() {
this.on('users.id', '=', 'contacts.id').andOnNotIn('contacts.id', [7, 15, 23, 41]);
});
knex.select('*').from('users').join('contacts', () => {
knex.select('*').from('users').join('contacts', function() {
this.on('users.id', '=', 'contacts.id').orOnNotIn('contacts.id', [7, 15, 23, 41]);
});
knex.select('*').from('users').join('contacts', () => {
knex.select('*').from('users').join('contacts', function() {
this.on('users.id', '=', 'contacts.id').onNull('contacts.email');
});
knex.select('*').from('users').join('contacts', () => {
knex.select('*').from('users').join('contacts', function() {
this.on('users.id', '=', 'contacts.id').andOnNull('contacts.email');
});
knex.select('*').from('users').join('contacts', () => {
knex.select('*').from('users').join('contacts', function() {
this.on('users.id', '=', 'contacts.id').orOnNull('contacts.email');
});
knex.select('*').from('users').join('contacts', () => {
knex.select('*').from('users').join('contacts', function() {
this.on('users.id', '=', 'contacts.id').onNotNull('contacts.email');
});
knex.select('*').from('users').join('contacts', () => {
knex.select('*').from('users').join('contacts', function() {
this.on('users.id', '=', 'contacts.id').andOnNotNull('contacts.email');
});
knex.select('*').from('users').join('contacts', () => {
knex.select('*').from('users').join('contacts', function() {
this.on('users.id', '=', 'contacts.id').orOnNotNull('contacts.email');
});
knex.select('*').from('users').join('contacts', () => {
this.on('users.id', '=', 'contacts.id').onExists(() => {
knex.select('*').from('users').join('contacts', function() {
this.on('users.id', '=', 'contacts.id').onExists(function() {
this.select('*').from('accounts').whereRaw('users.account_id = accounts.id');
});
});
knex.select('*').from('users').join('contacts', () => {
this.on('users.id', '=', 'contacts.id').andOnExists(() => {
knex.select('*').from('users').join('contacts', function() {
this.on('users.id', '=', 'contacts.id').andOnExists(function() {
this.select('*').from('accounts').whereRaw('users.account_id = accounts.id');
});
});
knex.select('*').from('users').join('contacts', () => {
this.on('users.id', '=', 'contacts.id').orOnExists(() => {
knex.select('*').from('users').join('contacts', function() {
this.on('users.id', '=', 'contacts.id').orOnExists(function() {
this.select('*').from('accounts').whereRaw('users.account_id = accounts.id');
});
});
knex.select('*').from('users').join('contacts', () => {
this.on('users.id', '=', 'contacts.id').onNotExists(() => {
knex.select('*').from('users').join('contacts', function() {
this.on('users.id', '=', 'contacts.id').onNotExists(function() {
this.select('*').from('accounts').whereRaw('users.account_id = accounts.id');
});
});
knex.select('*').from('users').join('contacts', () => {
this.on('users.id', '=', 'contacts.id').andOnNotExists(() => {
knex.select('*').from('users').join('contacts', function() {
this.on('users.id', '=', 'contacts.id').andOnNotExists(function() {
this.select('*').from('accounts').whereRaw('users.account_id = accounts.id');
});
});
knex.select('*').from('users').join('contacts', () => {
this.on('users.id', '=', 'contacts.id').orOnNotExists(() => {
knex.select('*').from('users').join('contacts', function() {
this.on('users.id', '=', 'contacts.id').orOnNotExists(function() {
this.select('*').from('accounts').whereRaw('users.account_id = accounts.id');
});
});
knex.select('*').from('users').join('contacts', () => {
knex.select('*').from('users').join('contacts', function() {
this.on('users.id', '=', 'contacts.id').onBetween('contacts.id', [5, 30]);
});
knex.select('*').from('users').join('contacts', () => {
knex.select('*').from('users').join('contacts', function() {
this.on('users.id', '=', 'contacts.id').andOnBetween('contacts.id', [5, 30]);
});
knex.select('*').from('users').join('contacts', () => {
knex.select('*').from('users').join('contacts', function() {
this.on('users.id', '=', 'contacts.id').orOnBetween('contacts.id', [5, 30]);
});
knex.select('*').from('users').join('contacts', () => {
knex.select('*').from('users').join('contacts', function() {
this.on('users.id', '=', 'contacts.id').onNotBetween('contacts.id', [5, 30]);
});
knex.select('*').from('users').join('contacts', () => {
knex.select('*').from('users').join('contacts', function() {
this.on('users.id', '=', 'contacts.id').andOnNotBetween('contacts.id', [5, 30]);
});
knex.select('*').from('users').join('contacts', () => {
knex.select('*').from('users').join('contacts', function() {
this.on('users.id', '=', 'contacts.id').orOnNotBetween('contacts.id', [5, 30]);
});
knex.select('*').from('users').join('contacts', () => {
this.on('users.id', '=', 'contacts.id').onNotExists(() => {
knex.select('*').from('users').join('contacts', function() {
this.on('users.id', '=', 'contacts.id').onNotExists(function() {
this.select('*').from('accounts').whereRaw('users.account_id = accounts.id');
});
});
@@ -475,7 +475,7 @@ knex.from('users').innerJoin('accounts', 'users.id', 'accounts.user_id');
knex.table('users').innerJoin('accounts', 'users.id', '=', 'accounts.user_id');
knex('users').innerJoin('accounts', () => {
knex('users').innerJoin('accounts', function() {
this.on('accounts.id', '=', 'users.account_id').orOn('accounts.owner_id', '=', 'users.id');
});
@@ -485,7 +485,7 @@ knex('users').innerJoin('accounts', (join: Knex.JoinClause) => {
knex.select('*').from('users').leftJoin('accounts', 'users.id', 'accounts.user_id');
knex.select('*').from('users').leftJoin('accounts', () => {
knex.select('*').from('users').leftJoin('accounts', function() {
this.on('accounts.id', '=', 'users.account_id').orOn('accounts.owner_id', '=', 'users.id');
});
@@ -502,13 +502,13 @@ knex.select('*').from('users').leftJoin('accounts', (join) => {
knex.select('*').from('users').leftOuterJoin('accounts', 'users.id', 'accounts.user_id');
knex.select('*').from('users').leftOuterJoin('accounts', () => {
knex.select('*').from('users').leftOuterJoin('accounts', function() {
this.on('accounts.id', '=', 'users.account_id').orOn('accounts.owner_id', '=', 'users.id');
});
knex.select('*').from('users').rightJoin('accounts', 'users.id', 'accounts.user_id');
knex.select('*').from('users').rightJoin('accounts', () => {
knex.select('*').from('users').rightJoin('accounts', function() {
this.on('accounts.id', '=', 'users.account_id').orOn('accounts.owner_id', '=', 'users.id');
});
@@ -518,13 +518,13 @@ knex.select('*').from('users').rightJoin('accounts', (join: Knex.JoinClause) =>
knex.select('*').from('users').rightOuterJoin('accounts', 'users.id', 'accounts.user_id');
knex.select('*').from('users').rightOuterJoin('accounts', () => {
knex.select('*').from('users').rightOuterJoin('accounts', function() {
this.on('accounts.id', '=', 'users.account_id').orOn('accounts.owner_id', '=', 'users.id');
});
knex.select('*').from('users').outerJoin('accounts', 'users.id', 'accounts.user_id');
knex.select('*').from('users').outerJoin('accounts', () => {
knex.select('*').from('users').outerJoin('accounts', function() {
this.on('accounts.id', '=', 'users.account_id').orOn('accounts.owner_id', '=', 'users.id');
});
@@ -534,7 +534,7 @@ knex.select('*').from('users').outerJoin('accounts', (join: Knex.JoinClause) =>
knex.select('*').from('users').fullOuterJoin('accounts', 'users.id', 'accounts.user_id');
knex.select('*').from('users').fullOuterJoin('accounts', () => {
knex.select('*').from('users').fullOuterJoin('accounts', function() {
this.on('accounts.id', '=', 'users.account_id').orOn('accounts.owner_id', '=', 'users.id');
});
@@ -549,39 +549,39 @@ knex.select('*').from('accounts').joinRaw('natural full join table1').where('id'
knex.select('*').from('accounts').join(knex.raw('natural full join table1')).where('id', 1);
knex.select('*').from('accounts')
.join(() => {
.join(function() {
this.select('*').from('accounts').as('special_accounts');
}, 'special_accounts.a', '=', 'accounts.b');
knex.select('*').from('accounts')
.leftJoin(() => {
.leftJoin(function() {
this.select('*').from('accounts').as('special_accounts');
}, 'special_accounts.a', '=', 'accounts.b');
knex.select('*').from('accounts')
.leftOuterJoin(() => {
.leftOuterJoin(function() {
this.select('*').from('accounts').as('special_accounts');
}, 'special_accounts.a', '=', 'accounts.b');
knex.select('*').from('accounts')
.rightJoin(() => {
.rightJoin(function() {
this.select('*').from('accounts').as('special_accounts');
}, 'special_accounts.a', '=', 'accounts.b');
knex.select('*').from('accounts')
.rightOuterJoin(() => {
.rightOuterJoin(function() {
this.select('*').from('accounts').as('special_accounts');
}, 'special_accounts.a', '=', 'accounts.b');
knex.select('*').from('accounts')
.innerJoin(() => {
.innerJoin(function() {
this.select('*').from('accounts').as('special_accounts');
}, 'special_accounts.a', '=', 'accounts.b');
knex.select('*').from('accounts')
.crossJoin(() => {
.crossJoin(function() {
this.select('*').from('accounts').as('special_accounts');
}, 'special_accounts.a', '=', 'accounts.b');
knex.select('*').from('accounts')
.fullOuterJoin(() => {
.fullOuterJoin(function() {
this.select('*').from('accounts').as('special_accounts');
}, 'special_accounts.a', '=', 'accounts.b');
knex.select('*').from('accounts')
.outerJoin(() => {
.outerJoin(function() {
this.select('*').from('accounts').as('special_accounts');
}, 'special_accounts.a', '=', 'accounts.b');
@@ -1044,66 +1044,66 @@ knex.select('*').from('users').where(knex.raw('id = ?', [1])).toSQL();
//
knex('users')
.select('*')
.join('contacts', (builder) => {
this.on((builder: any) => {
.join('contacts', function(builder) {
this.on(function(builder: any) {
let self: Knex.JoinClause = this;
self = builder;
}).andOn((builder: any) => {
}).andOn(function(builder: any) {
let self: Knex.JoinClause = this;
self = builder;
}).orOn((builder: any) => {
}).orOn(function(builder: any) {
let self: Knex.JoinClause = this;
self = builder;
}).onExists((builder: any) => {
}).onExists(function(builder: any) {
let self: Knex.QueryBuilder = this;
self = builder;
}).orOnExists((builder: any) => {
}).orOnExists(function(builder: any) {
let self: Knex.QueryBuilder = this;
self = builder;
}).andOnExists((builder: any) => {
}).andOnExists(function(builder: any) {
let self: Knex.QueryBuilder = this;
self = builder;
}).onNotExists((builder: any) => {
}).onNotExists(function(builder: any) {
let self: Knex.QueryBuilder = this;
self = builder;
}).andOnNotExists((builder: any) => {
}).andOnNotExists(function(builder: any) {
let self: Knex.QueryBuilder = this;
self = builder;
}).orOnNotExists((builder: any) => {
}).orOnNotExists(function(builder: any) {
let self: Knex.QueryBuilder = this;
self = builder;
});
}).where((builder) => {
}).where(function(builder) {
let self: Knex.QueryBuilder = this;
self = builder;
}).orWhere((builder) => {
}).orWhere(function(builder) {
let self: Knex.QueryBuilder = this;
self = builder;
}).andWhere((builder) => {
}).andWhere(function(builder) {
let self: Knex.QueryBuilder = this;
self = builder;
}).whereIn('column', (builder) => {
}).whereIn('column', function(builder) {
let self: Knex.QueryBuilder = this;
self = builder;
}).orWhereIn('column', (builder) => {
}).orWhereIn('column', function(builder) {
let self: Knex.QueryBuilder = this;
self = builder;
}).whereNotIn('column', (builder) => {
}).whereNotIn('column', function(builder) {
let self: Knex.QueryBuilder = this;
self = builder;
}).orWhereNotIn('column', (builder) => {
}).orWhereNotIn('column', function(builder) {
let self: Knex.QueryBuilder = this;
self = builder;
}).whereWrapped((builder) => {
}).whereWrapped(function(builder) {
let self: Knex.QueryBuilder = this;
self = builder;
}).union((builder) => {
}).union(function(builder) {
let self: Knex.QueryBuilder = this;
self = builder;
}).unionAll((builder) => {
}).unionAll(function(builder) {
let self: Knex.QueryBuilder = this;
self = builder;
}).modify((builder, aBool) => {
}).modify(function(builder, aBool) {
let self: Knex.QueryBuilder = this;
self = builder;
}, true);
@@ -1197,12 +1197,12 @@ knex('characters')
knex('characters')
.select()
.whereIn('name', () => {
.whereIn('name', function() {
this.select('name').from('characters');
});
knex('characters')
.select()
.whereIn(['name', 'class'], () => {
.whereIn(['name', 'class'], function() {
this.select('name', 'class').from('characters');
});

View File

@@ -3,13 +3,13 @@ import mount = require("koa-mount");
const a = new Koa();
a.use((next) => {
a.use(function(next) {
this.body = "Hello";
});
const b = new Koa();
b.use((next) => {
b.use(function(next) {
this.body = "World";
});

View File

@@ -311,7 +311,7 @@ var scope = nock('http://www.google.com')
/// Access original request and headers
var scope = nock('http://www.google.com')
.get('/cat-poems')
.reply((uri, requestBody) => {
.reply(function (uri, requestBody) {
console.log('path:', this.req.path);
console.log('headers:', this.req.headers);
// ...

View File

@@ -96,7 +96,7 @@ phantom.create(["--web-security=no", "--ignore-ssl-errors=yes"]).then((ph) => {
phantom.create().then((ph) => {
return ph.createPage().then((page) => {
page.open("http://localhost:9901/cookie").then((status) => {
var someFunc = (aaa: string, my_obj: Object) => {
var someFunc = function (aaa: string, my_obj: Object) {
var attribute_to_want = aaa;
var h2Arr: string[] = [];
var results = document.querySelectorAll(attribute_to_want);

View File

@@ -2180,7 +2180,7 @@ class Rectangle {
this.colors = Array.prototype.slice.call(arguments, 1);
}
Circle.prototype.area = () => Math.PI * Math.pow(this.r, 2);
Circle.prototype.area = function() { return Math.PI * Math.pow(this.r, 2); };
const circleN = R.constructN(2, Circle);
let c1 = circleN(1, "red");
@@ -2623,7 +2623,7 @@ class Rectangle {
const Why: any = ((val: boolean) => {
const why = {} as any;
why.val = val;
why.and = (x: boolean) => this.val && x;
why.and = function(x: boolean) { return this.val && x; };
return Why;
})(true);
const why = new Why(true);

View File

@@ -10,7 +10,7 @@ Rivets.configure({
// Template delimiters for text bindings
templateDelimiters: ['[[', ']]'],
// Augment the event handler of the on-* binder
handler: (target: any, event: any, binding: any) => {
handler(target: any, event: any, binding: any) {
this.call(target, event, binding.view.models);
}
});

View File

@@ -8,7 +8,7 @@ var app = angular.module('testModule');
interface AppScope extends rx.angular.IRxScope {
}
app.controller('Ctrl', ($scope: AppScope) => {
app.controller('Ctrl', function ($scope: AppScope) {
this.inputObservable = $scope.$toObservable('term')
.safeApply($scope, (results: any) => {

View File

@@ -1242,7 +1242,7 @@ s.query( '' );
s.query( '' ).then( function( res ) {} );
s.query( { query : 'select ? as foo, ? as bar', values : [1, 2] }, { raw : true, replacements : [1, 2] } );
s.query( '', { raw : true, nest : false } );
s.query( 'select ? as foo, ? as bar', { type : this.sequelize.QueryTypes.SELECT, replacements : [1, 2] } );
s.query( 'select ? as foo, ? as bar', { type : sequelize.QueryTypes.SELECT, replacements : [1, 2] } );
s.query( { query : 'select ? as foo, ? as bar', values : [1, 2] }, { type : s.QueryTypes.SELECT } );
s.query( 'select :one as foo, :two as bar', { raw : true, replacements : { one : 1, two : 2 } } );
s.transaction().then( function( t ) { s.set( { foo : 'bar' }, { transaction : t } ); } );

View File

@@ -1140,7 +1140,7 @@ s.query( '' );
s.query( '' ).then( function( res ) {} );
s.query( { query : 'select ? as foo, ? as bar', values : [1, 2] }, { raw : true, replacements : [1, 2] } );
s.query( '', { raw : true, nest : false } );
s.query( 'select ? as foo, ? as bar', { type : this.sequelize.QueryTypes.SELECT, replacements : [1, 2] } );
s.query( 'select ? as foo, ? as bar', { type : sequelize.QueryTypes.SELECT, replacements : [1, 2] } );
s.query( { query : 'select ? as foo, ? as bar', values : [1, 2] }, { type : s.QueryTypes.SELECT } );
s.query( 'select :one as foo, :two as bar', { raw : true, replacements : { one : 1, two : 2 } } );
s.transaction().then( function( t ) { s.set( { foo : 'bar' }, { transaction : t } ); } );

View File

@@ -10,7 +10,7 @@ server = simplesmtp.createSimpleServer({
name: "localhost",
secureConnection: false,
SMTPBanner: "Hoi dit is de test server",
timeout: this.timeout,
timeout: (this as any).timeout,
ignoreTLS: true
}, (req: simplesmtp.SimpleServerConnection) => {
req.on("data", (chunk: Buffer): void => {
@@ -21,10 +21,10 @@ server = simplesmtp.createSimpleServer({
});
req.accept("12");
});
this._server.server.on("authorizeUser",
(this as any)._server.server.on("authorizeUser",
(envelope: any, username: string|Buffer, password: string, callback: (error: Error, success: boolean) => void
): void => {
callback(null, true);
});
this._server.listen(this.port, "0.0.0.0", (error?: Error): void => {
(this as any)._server.listen(this.port, "0.0.0.0", (error?: Error): void => {
});

View File

@@ -359,7 +359,7 @@ new ssh2.Server({
}).on('end', () => {
console.log('Client disconnected');
});
}).listen(0, '127.0.0.1', () => {
}).listen(0, '127.0.0.1', function () {
console.log('Listening on port ' + this.address().port);
});
@@ -425,7 +425,7 @@ new ssh2.Server({
}).on('end', () => {
console.log('Client disconnected');
});
}).listen(0, '127.0.0.1', () => {
}).listen(0, '127.0.0.1', function () {
console.log('Listening on port ' + this.address().port);
});

View File

@@ -1,6 +1,6 @@
import stampit = require('stampit');
const a = stampit().init((options) => {
const a = stampit().init(function(options) {
const a = options.args[0];
this.getA = () => {
return a;
@@ -154,7 +154,7 @@ interface SomeStamp extends stampit.Stamp {
}
const SomeStamp = stampit()
.init((params: { a: number; b: boolean}) => {
.init(function(params: { a: number; b: boolean}) {
this.a = '' + a;
this.b = '' + b;
}) as SomeStamp;

View File

@@ -2,7 +2,7 @@
import stampit = require('stampit');
var a = stampit().init((options) => {
var a = stampit().init(function (options) {
var a = options.args[0];
this.getA = () => {
return a;

View File

@@ -1,6 +1,6 @@
var _vrEffect: THREE.VREffect;
_vrEffect = new THREE.VREffect(new THREE.WebGLRenderer({antialias: true}), (error) => {
_vrEffect = new THREE.VREffect(new THREE.WebGLRenderer({antialias: true}), function (error) {
if (error) {
this._stats.classList.add("error");
this._stats.innerHTML = "WebVR API not supported";

View File

@@ -502,7 +502,7 @@ describe('dest stream', () => {
const stream1 = vfs.dest('./out-fixtures/', { cwd: __dirname });
const stream2 = vfs.dest('./out-fixtures/', { cwd: __dirname });
const content = fs.readFileSync(srcPath);
const rename = through.obj((file: any, _: any, next: any) => {
const rename = through.obj(function(file: any, _: any, next: any) {
file.path = inputPath2;
this.push(file);
next();

View File

@@ -502,7 +502,7 @@ describe('dest stream', () => {
const stream1 = vfs.dest('./out-fixtures/', { cwd: __dirname });
const stream2 = vfs.dest('./out-fixtures/', { cwd: __dirname });
const content = fs.readFileSync(srcPath);
const rename = through.obj((file: any, _: any, next: any) => {
const rename = through.obj(function(file: any, _: any, next: any) {
file.path = inputPath2;
this.push(file);
next();

View File

@@ -173,10 +173,10 @@ const valid2 = {
cb("http://");
}, 1);
},
before: () => {
before: function () {
return this.endDate;
},
after: () => {
after: function () {
return this.startDate;
}
};

View File

@@ -1,4 +1,4 @@
const onFulfilled = (item: WebMidi.MIDIAccess) => {
const onFulfilled = function(item: WebMidi.MIDIAccess) {
this._midiPort = item;
item.onstatechange = (event: WebMidi.MIDIConnectionEvent) => {