diff --git a/types/acorn/index.d.ts b/types/acorn/index.d.ts index 5d02bd716c..e6a9291d1c 100644 --- a/types/acorn/index.d.ts +++ b/types/acorn/index.d.ts @@ -246,9 +246,7 @@ declare namespace acorn { let LooseParser: ILooseParserClass | undefined; let pluginsLoose: PluginsObject | undefined; - interface ILooseParserClass { - new (input: string, options?: Options): ILooseParser; - } + type ILooseParserClass = new (input: string, options?: Options) => ILooseParser; interface ILooseParser {} diff --git a/types/continuation-local-storage/continuation-local-storage-tests.ts b/types/continuation-local-storage/continuation-local-storage-tests.ts index aee44866af..9ab06a89d2 100644 --- a/types/continuation-local-storage/continuation-local-storage-tests.ts +++ b/types/continuation-local-storage/continuation-local-storage-tests.ts @@ -438,10 +438,10 @@ test("simple tracer built on contexts", function (t) { this.harvester = harvester; } runHandler(callback: any) { - const wrapped = tracer.bind(function () { + const wrapped = tracer.bind(() => { callback(); this.harvester.emit('finished', tracer.get('transaction')); - }.bind(this)); + }); wrapped(); } } diff --git a/types/es-feature-detection/es-feature-detection-tests.ts b/types/es-feature-detection/es-feature-detection-tests.ts index 13b779c1bb..3e769f6636 100644 --- a/types/es-feature-detection/es-feature-detection-tests.ts +++ b/types/es-feature-detection/es-feature-detection-tests.ts @@ -6,7 +6,7 @@ if (fns["Array.prototype.includes"]) { } const syntax = es.syntax(); if (syntax["Arrow function"]) { - new Function("() => {}"); + // new Function("() => {}"); } if (fns.es2017.__all && syntax.es2017.__all) { diff --git a/types/jpm/jpm-tests.ts b/types/jpm/jpm-tests.ts index 34523f1a14..c6451aea9c 100644 --- a/types/jpm/jpm-tests.ts +++ b/types/jpm/jpm-tests.ts @@ -37,7 +37,7 @@ import * as prefs from "sdk/simple-prefs"; type prefType = {pref1: string}; (prefs.prefs as prefType)["pref1"] = "value"; prefs.on("pref1", () => console.log("pref1 changed")); -prefs.removeListener("pref1", new Function()); +prefs.removeListener("pref1", () => {}); import * as storage from "sdk/simple-storage"; storage.storage.value = 10; diff --git a/types/mysql/mysql-tests.ts b/types/mysql/mysql-tests.ts index d8abfe1dcd..c9853bf116 100644 --- a/types/mysql/mysql-tests.ts +++ b/types/mysql/mysql-tests.ts @@ -121,12 +121,12 @@ sql = mysql.format(sql, inserts); connection.config.queryFormat = function(query, values) { if (!values) return query; - return query.replace(/\:(\w+)/g, function(txt: string, key: string) { + return query.replace(/\:(\w+)/g, (txt: string, key: string) => { if (values.hasOwnProperty(key)) { return this.escape(values[key]); } return txt; - }.bind(this)); + }); }; connection.query("UPDATE posts SET title = :title", {title: "Hello MySQL"}); diff --git a/types/react-data-grid/react-data-grid-tests.tsx b/types/react-data-grid/react-data-grid-tests.tsx index 201e53a3ca..dc23d2a996 100644 --- a/types/react-data-grid/react-data-grid-tests.tsx +++ b/types/react-data-grid/react-data-grid-tests.tsx @@ -252,11 +252,11 @@ class Example extends React.Component { getColumns() { var clonedColumns = columns.slice(); clonedColumns[2].events = { - onClick: function (ev:React.SyntheticEvent, args:{idx:number, rowIdx:number}) { + onClick: (ev:React.SyntheticEvent, args:{idx:number, rowIdx:number}) => { var idx = args.idx; var rowIdx = args.rowIdx; - this.refs.grid.openCellEditor(rowIdx, idx); - }.bind(this) + (this.refs.grid as ReactDataGrid<{}>).openCellEditor(rowIdx, idx); + } }; return clonedColumns; diff --git a/types/react-data-grid/v1/react-data-grid-tests.tsx b/types/react-data-grid/v1/react-data-grid-tests.tsx index 371831b43a..5b23c55898 100644 --- a/types/react-data-grid/v1/react-data-grid-tests.tsx +++ b/types/react-data-grid/v1/react-data-grid-tests.tsx @@ -198,11 +198,11 @@ class Example extends React.Component { getColumns() { var clonedColumns = columns.slice(); clonedColumns[2].events = { - onClick: function (ev:React.SyntheticEvent, args:{idx:number, rowIdx:number}) { + onClick: (ev:React.SyntheticEvent, args:{idx:number, rowIdx:number}) => { var idx = args.idx; var rowIdx = args.rowIdx; - this.refs.grid.openCellEditor(rowIdx, idx); - }.bind(this) + (this.refs.grid as ReactDataGrid) + } }; return clonedColumns; diff --git a/types/react-data-grid/v2/react-data-grid-tests.tsx b/types/react-data-grid/v2/react-data-grid-tests.tsx index aa09041846..c1c39aee05 100644 --- a/types/react-data-grid/v2/react-data-grid-tests.tsx +++ b/types/react-data-grid/v2/react-data-grid-tests.tsx @@ -252,11 +252,11 @@ class Example extends React.Component { getColumns() { var clonedColumns = columns.slice(); clonedColumns[2].events = { - onClick: function (ev:React.SyntheticEvent, args:{idx:number, rowIdx:number}) { + onClick: (ev:React.SyntheticEvent, args:{idx:number, rowIdx:number}) => { var idx = args.idx; var rowIdx = args.rowIdx; - this.refs.grid.openCellEditor(rowIdx, idx); - }.bind(this) + (this.refs.grid as ReactDataGrid).openCellEditor(rowIdx, idx); + } }; return clonedColumns; diff --git a/types/react-native-doc-viewer/react-native-doc-viewer-tests.tsx b/types/react-native-doc-viewer/react-native-doc-viewer-tests.tsx index cdc7e3980e..466900ec6e 100644 --- a/types/react-native-doc-viewer/react-native-doc-viewer-tests.tsx +++ b/types/react-native-doc-viewer/react-native-doc-viewer-tests.tsx @@ -102,17 +102,17 @@ export default class DocViewerExample extends React.Component { Doc Viewer React Native