From 219dd6df82e7ee9023e8602e58102e22781fb12f Mon Sep 17 00:00:00 2001 From: Andy Date: Wed, 10 Jan 2018 14:59:37 -0800 Subject: [PATCH] Fix 'prefer-readonly' lint failures (#22819) --- .../angular-material-tests.ts | 2 +- types/angular-scroll/angular-scroll-tests.ts | 4 ++-- .../angular-signalr-hub-tests.ts | 2 +- .../angular-ui-router-tests.ts | 8 +++---- types/angular/angular-tests.ts | 2 +- .../angularlocalstorage-tests.ts | 2 +- types/bardjs/bardjs-tests.ts | 2 +- types/braft-editor/braft-editor-tests.tsx | 4 ++-- types/camo/camo-tests.ts | 8 +++---- types/css-modules/css-modules-tests.ts | 2 +- types/d3-geo/d3-geo-tests.ts | 6 ++--- types/d3-shape/d3-shape-tests.ts | 20 ++++++++-------- .../google-cloud__storage-tests.ts | 3 --- .../google-drive-realtime-api-tests.ts | 2 +- types/jest/jest-tests.ts | 4 ++-- types/jest/v16/jest-tests.ts | 2 +- types/knockout/test/index.ts | 2 +- .../knuddels-userapps-api-tests.ts | 22 ++++++++--------- types/meteor/meteor-tests.ts | 8 +------ types/nedb/nedb-tests.ts | 2 +- types/ng-cordova/test/appAvailability.ts | 4 ++-- types/ng-cordova/test/deviceMotion.ts | 2 +- types/ng-cordova/test/deviceOrientation.ts | 4 ++-- types/ng-cordova/test/dialogs.ts | 2 +- types/ng-cordova/test/geolocation.ts | 2 +- types/ng-cordova/test/network.ts | 2 +- types/ng-cordova/test/toast.ts | 2 +- types/ng-file-upload/ng-file-upload-tests.ts | 2 +- types/ng-stomp/ng-stomp-tests.ts | 2 +- types/ngbootbox/ngbootbox-tests.ts | 8 +++---- types/openui5/openui5-tests.ts | 2 +- types/p-queue/p-queue-tests.ts | 2 +- types/pixi.js/tslint.json | 1 + types/q/q-tests.ts | 2 +- types/q/v0/q-tests.ts | 2 +- types/rc-select/rc-select-tests.ts | 6 ++--- .../react-dnd-html5-backend-tests.ts | 6 ++--- types/react-dnd/react-dnd-tests.tsx | 6 ++--- .../react-hamburger-menu-tests.tsx | 2 +- types/react-intl/v1/react-intl-tests.tsx | 6 ++--- .../react-native-drawer-layout-tests.tsx | 6 ++--- .../react-native-drawer-tests.tsx | 4 ++-- .../react-native-snap-carousel-tests.tsx | 6 ++--- .../react-navigation-tests.tsx | 2 +- .../react-router/test/NavigateWithContext.tsx | 2 +- types/react-select/react-select-tests.tsx | 20 ++++++++-------- .../react-sortable-hoc-tests.tsx | 2 +- types/react-swipe/react-swipe-tests.tsx | 8 +++---- .../react-swipeable/react-swipeable-tests.tsx | 24 +++++++++---------- types/react-touch/react-touch-tests.tsx | 8 +++---- types/react/test/index.ts | 2 +- types/react/v15/test/index.ts | 2 +- types/reactstrap/reactstrap-tests.tsx | 2 +- types/rot-js/rot-js-tests.ts | 4 ++-- types/rrc/rrc-tests.tsx | 6 ++--- .../screeps-profiler-tests.ts | 2 +- types/sharepoint/sharepoint-tests.ts | 2 +- types/slickgrid/test/index.ts | 2 +- types/wallabyjs/wallabyjs-tests.ts | 2 +- types/whatwg-streams/whatwg-streams-tests.ts | 4 ++-- types/when/when-tests.ts | 2 +- types/yfiles/yfiles-tests.ts | 4 ++-- 62 files changed, 140 insertions(+), 148 deletions(-) diff --git a/types/angular-material/angular-material-tests.ts b/types/angular-material/angular-material-tests.ts index ac4a1386cd..8d6955c697 100644 --- a/types/angular-material/angular-material-tests.ts +++ b/types/angular-material/angular-material-tests.ts @@ -196,7 +196,7 @@ myApp.controller('DialogController', ($scope: TestScope, $mdDialog: ng.material. }); class IconDirective implements ng.IDirective { - private $mdIcon: ng.material.IIcon; + private readonly $mdIcon: ng.material.IIcon; constructor($mdIcon: ng.material.IIcon) { this.$mdIcon = $mdIcon; } diff --git a/types/angular-scroll/angular-scroll-tests.ts b/types/angular-scroll/angular-scroll-tests.ts index fbc1c01642..84491706bc 100644 --- a/types/angular-scroll/angular-scroll-tests.ts +++ b/types/angular-scroll/angular-scroll-tests.ts @@ -50,11 +50,11 @@ namespace TestApp { var horixontalPosition: number = $document.duScrollLeft(); } - private invertedEasingFn = (x: number): number => { + private readonly invertedEasingFn = (x: number): number => { return 1 - x; } - private onScrollCompleted = (): void => { + private readonly onScrollCompleted = (): void => { console.log('Done scrolling'); } } diff --git a/types/angular-signalr-hub/angular-signalr-hub-tests.ts b/types/angular-signalr-hub/angular-signalr-hub-tests.ts index 14d202e171..62ea189787 100644 --- a/types/angular-signalr-hub/angular-signalr-hub-tests.ts +++ b/types/angular-signalr-hub/angular-signalr-hub-tests.ts @@ -1,6 +1,6 @@ class EmployeesFactory { static $inject = ['$rootScope', 'Hub', '$timeout']; - private hub: ngSignalr.Hub; + private readonly hub: ngSignalr.Hub; public all: Array; constructor($rootScope: ng.IRootScopeService, Hub: ngSignalr.HubFactory, $timeout: ng.ITimeoutService) { diff --git a/types/angular-ui-router/angular-ui-router-tests.ts b/types/angular-ui-router/angular-ui-router-tests.ts index 406e94a1eb..889e92bfc9 100644 --- a/types/angular-ui-router/angular-ui-router-tests.ts +++ b/types/angular-ui-router/angular-ui-router-tests.ts @@ -137,10 +137,10 @@ class UrlLocatorTestService implements IUrlLocatorTestService { static $inject = ["$http", "$rootScope", "$urlRouter", "$state"]; constructor( - private $http: ng.IHttpService, - private $rootScope: ng.IRootScopeService, - private $urlRouter: ng.ui.IUrlRouterService, - private $state: ng.ui.IStateService + private readonly $http: ng.IHttpService, + private readonly $rootScope: ng.IRootScopeService, + private readonly $urlRouter: ng.ui.IUrlRouterService, + private readonly $state: ng.ui.IStateService ) { $rootScope.$on("$locationChangeSuccess", (event: ng.IAngularEvent) => this.onLocationChangeSuccess(event)); $rootScope.$on('$stateNotFound', (event: ng.IAngularEvent, unfoundState: ng.ui.IUnfoundState, fromState: ng.ui.IState, fromParams: {}) => diff --git a/types/angular/angular-tests.ts b/types/angular/angular-tests.ts index 15d4d6a137..795e74a058 100644 --- a/types/angular/angular-tests.ts +++ b/types/angular/angular-tests.ts @@ -161,7 +161,7 @@ namespace My.Namespace { } class TestProvider implements ng.IServiceProvider { - constructor(private $scope: ng.IScope) {} + constructor(private readonly $scope: ng.IScope) {} $get() {} } diff --git a/types/angularlocalstorage/angularlocalstorage-tests.ts b/types/angularlocalstorage/angularlocalstorage-tests.ts index 22d71f8b5d..df50c6694a 100644 --- a/types/angularlocalstorage/angularlocalstorage-tests.ts +++ b/types/angularlocalstorage/angularlocalstorage-tests.ts @@ -3,7 +3,7 @@ interface TestScope extends ng.IScope { } class TestController { - constructor(private $scope: TestScope, private storage: ng.localStorage.ILocalStorageService) { + constructor(private readonly $scope: TestScope, private readonly storage: ng.localStorage.ILocalStorageService) { storage.bind($scope, 'varName'); storage.bind($scope,'varName', { defaultValue: 'randomValue123', storeName: 'customStoreKey' }); $scope.viewType = 'ANYTHING'; diff --git a/types/bardjs/bardjs-tests.ts b/types/bardjs/bardjs-tests.ts index 52f5ab1d3f..de656bc22e 100644 --- a/types/bardjs/bardjs-tests.ts +++ b/types/bardjs/bardjs-tests.ts @@ -5,7 +5,7 @@ var expect = chai.expect, assert = chai.assert; class MyService { - constructor(private $q: angular.IQService) {} + constructor(private readonly $q: angular.IQService) {} remoteCall(): angular.IPromise { return new this.$q((resolve, reject) => { diff --git a/types/braft-editor/braft-editor-tests.tsx b/types/braft-editor/braft-editor-tests.tsx index 354c4cbb5b..584927e0bd 100644 --- a/types/braft-editor/braft-editor-tests.tsx +++ b/types/braft-editor/braft-editor-tests.tsx @@ -22,10 +22,10 @@ class BraftEditorTest extends React.Component { ); } - private handleChange = (content: RawDraftContentState) => { + private readonly handleChange = (content: RawDraftContentState) => { console.log(content); } - private handleHTMLChange = (html: string) => { + private readonly handleHTMLChange = (html: string) => { console.log(html); } } diff --git a/types/camo/camo-tests.ts b/types/camo/camo-tests.ts index 6830133f8f..b88f7007f6 100644 --- a/types/camo/camo-tests.ts +++ b/types/camo/camo-tests.ts @@ -16,10 +16,10 @@ connect("mongodb://user:password@localhost:27017/database?authSource=admin").the } class User extends CamoDocument { - private name: SchemaTypeExtended = String; - private password: SchemaTypeExtended = String; - private friends: SchemaTypeExtended = [String]; - private dateCreated: SchemaTypeExtended = { + private readonly name: SchemaTypeExtended = String; + private readonly password: SchemaTypeExtended = String; + private readonly friends: SchemaTypeExtended = [String]; + private readonly dateCreated: SchemaTypeExtended = { type: Date, default: Date.now }; diff --git a/types/css-modules/css-modules-tests.ts b/types/css-modules/css-modules-tests.ts index e6479ba2d5..685e322703 100644 --- a/types/css-modules/css-modules-tests.ts +++ b/types/css-modules/css-modules-tests.ts @@ -2,7 +2,7 @@ import styles from './main.sass'; import * as classNames from 'classnames'; class App { - private theme: string; + private readonly theme: string; constructor(theme: string) { this.theme = theme; } diff --git a/types/d3-geo/d3-geo-tests.ts b/types/d3-geo/d3-geo-tests.ts index 876461e3e9..c4508351a0 100644 --- a/types/d3-geo/d3-geo-tests.ts +++ b/types/d3-geo/d3-geo-tests.ts @@ -205,9 +205,9 @@ class Circulator { return d ? d : [0, 0]; }); } - private r: number; - private p: number; - private circleGenerator: d3Geo.GeoCircleGenerator; + private readonly r: number; + private readonly p: number; + private readonly circleGenerator: d3Geo.GeoCircleGenerator; getCirclePolygon(center?: [number, number]): GeoJSON.Polygon { if (center && center.length === 2 && typeof center[0] === 'number' && typeof center[1] === 'number') { diff --git a/types/d3-shape/d3-shape-tests.ts b/types/d3-shape/d3-shape-tests.ts index 4199d2f170..687da79188 100644 --- a/types/d3-shape/d3-shape-tests.ts +++ b/types/d3-shape/d3-shape-tests.ts @@ -200,14 +200,14 @@ class Arcer { .endAngle(this.endAngle) .padAngle(this.padAngle); } - private startAngle: number; - private endAngle: number; - private padAngle: number; - private innerRadius: number; - private outerRadius: number; - private cornerRadius: number; + private readonly startAngle: number; + private readonly endAngle: number; + private readonly padAngle: number; + private readonly innerRadius: number; + private readonly outerRadius: number; + private readonly cornerRadius: number; - private arc: d3Shape.Arc; + private readonly arc: d3Shape.Arc; getPathString(d?: ArcerDatum) { return d ? this.arc(d) : this.arc({ innerRadius: this.innerRadius, outerRadius: this.outerRadius }); @@ -1292,9 +1292,9 @@ class Symbolizer { return type; }); } - private size: number; - private type: d3Shape.SymbolType; - private symbol: d3Shape.Symbol; + private readonly size: number; + private readonly type: d3Shape.SymbolType; + private readonly symbol: d3Shape.Symbol; getPathString(d?: SymbolDatum) { return d ? this.symbol(d) : this.symbol(); diff --git a/types/google-cloud__storage/google-cloud__storage-tests.ts b/types/google-cloud__storage/google-cloud__storage-tests.ts index b277343bdb..24d300b8e6 100644 --- a/types/google-cloud__storage/google-cloud__storage-tests.ts +++ b/types/google-cloud__storage/google-cloud__storage-tests.ts @@ -40,9 +40,6 @@ export class TestStorage { // import Storage class static gcs = CloudStorage(); - // the bucket - private buckets: Bucket[] = []; - constructor() { // nothing to do } diff --git a/types/google-drive-realtime-api/google-drive-realtime-api-tests.ts b/types/google-drive-realtime-api/google-drive-realtime-api-tests.ts index af2313f147..7eb8708768 100644 --- a/types/google-drive-realtime-api/google-drive-realtime-api-tests.ts +++ b/types/google-drive-realtime-api/google-drive-realtime-api-tests.ts @@ -94,7 +94,7 @@ namespace GRealtime { export class MyRealtimeDoc { protected rtmodel: CollabModel; protected rtdoc: CollabDoc; - private myRTLoader = new GRealtime.MyRTLoader(); + private readonly myRTLoader = new GRealtime.MyRTLoader(); newFile(title: string, initializeModel: (x:CollabModel) => void, diff --git a/types/jest/jest-tests.ts b/types/jest/jest-tests.ts index 88f72f3f1a..4d8ae05e1c 100644 --- a/types/jest/jest-tests.ts +++ b/types/jest/jest-tests.ts @@ -288,7 +288,7 @@ describe('missing tests', () => { class Closure { private arg: T; - constructor(private fn: (arg: T) => void) { + constructor(private readonly fn: (arg: T) => void) { this.fn = fn; } @@ -522,7 +522,7 @@ describe('beforeEach with timeout', () => { class TestApi { constructor() { } testProp: boolean; - private anotherProp: string; + private readonly anotherProp: string; testMethod(a: number): string { return ""; } } diff --git a/types/jest/v16/jest-tests.ts b/types/jest/v16/jest-tests.ts index 7a58d6e9b1..6acfa77fa8 100644 --- a/types/jest/v16/jest-tests.ts +++ b/types/jest/v16/jest-tests.ts @@ -183,7 +183,7 @@ describe('missing tests', function () { class Closure { private arg: T; - public constructor(private fn: (arg: T) => void) { + public constructor(private readonly fn: (arg: T) => void) { this.fn = fn; } diff --git a/types/knockout/test/index.ts b/types/knockout/test/index.ts index 9913b64fa8..36db7657ed 100644 --- a/types/knockout/test/index.ts +++ b/types/knockout/test/index.ts @@ -90,7 +90,7 @@ function test_computed() { } class GetterViewModel { - private _selectedRange: KnockoutObservable; + private readonly _selectedRange: KnockoutObservable; constructor() { this._selectedRange = ko.observable(); diff --git a/types/knuddels-userapps-api/knuddels-userapps-api-tests.ts b/types/knuddels-userapps-api/knuddels-userapps-api-tests.ts index bf0933a5e1..4ee25c84ec 100644 --- a/types/knuddels-userapps-api/knuddels-userapps-api-tests.ts +++ b/types/knuddels-userapps-api/knuddels-userapps-api-tests.ts @@ -1,9 +1,9 @@ class Server implements App { - private usersPlaying: { [nick: string]: number } = {}; + private readonly usersPlaying = new Map(); private isShuttingDown = false; - private htmlFile: HTMLFile = new HTMLFile('start.html'); - private appContent: AppContent = AppContent.overlayContent(this.htmlFile, 243, 266); + private readonly htmlFile: HTMLFile = new HTMLFile('start.html'); + private readonly appContent: AppContent = AppContent.overlayContent(this.htmlFile, 243, 266); onAppStart() { KnuddelsServer.getChannel() @@ -21,11 +21,11 @@ class Server implements App { } onUserLeft(user: User) { - if (this.usersPlaying[user.getNick()] === 1) { + if (this.usersPlaying.get(user.getNick()) === 1) { KnuddelsServer.getDefaultBotUser() .transferKnuddel(user, new KnuddelAmount(1), 'Du hast den Channel verlassen.'); - delete this.usersPlaying[user.getNick()]; + this.usersPlaying.delete(user.getNick()); } } @@ -46,7 +46,7 @@ class Server implements App { session.remove(); }); - delete this.usersPlaying[key]; + this.usersPlaying.delete(key); } } } @@ -61,7 +61,7 @@ class Server implements App { knuddelTransfer.accept(); } else if (this.isShuttingDown) { knuddelTransfer.reject('Du App nimmt gerade keine neuen Spieler an.'); - } else if (this.usersPlaying[sender.getNick()]) { + } else if (this.usersPlaying.get(sender.getNick())) { knuddelTransfer.reject('Du spielst bereits.'); } else if (knuddelTransfer.getKnuddelAmount().asNumber() !== 1) { const botNick = KnuddelsServer.getDefaultBotUser() @@ -75,7 +75,7 @@ class Server implements App { onKnuddelReceived(user: User, receiver: User, knuddelAmount: KnuddelAmount) { if (knuddelAmount.asNumber() === 1) { - this.usersPlaying[user.getNick()] = 1; + this.usersPlaying.set(user.getNick(), 1); user.sendAppContent(this.appContent); } else { user.sendPrivateMessage('Vielen Dank für die Einzahlung.'); @@ -83,8 +83,8 @@ class Server implements App { } onEventReceived(user: User, key: string, data: string) { - if (key === 'selectedEntry' && this.usersPlaying[user.getNick()] === 1) { - this.usersPlaying[user.getNick()] = 2; + if (key === 'selectedEntry' && this.usersPlaying.get(user.getNick()) === 1) { + this.usersPlaying.set(user.getNick(), 2); setTimeout(() => { const doorNumber = parseInt(data[data.length - 1], 10); @@ -116,7 +116,7 @@ class Server implements App { .forEach((session: AppContentSession) => { session.remove(); }); - delete this.usersPlaying[user.getNick()]; + this.usersPlaying.delete(user.getNick()); }, 4000); }, 1500); } diff --git a/types/meteor/meteor-tests.ts b/types/meteor/meteor-tests.ts index 6c71fef438..0e457b9fc5 100644 --- a/types/meteor/meteor-tests.ts +++ b/types/meteor/meteor-tests.ts @@ -206,13 +206,7 @@ Posts.insert({ title: "Hello world", body: "First post" }); **/ class Animal { - private sound: string; - constructor(doc: any) { - - } - makeNoise() { - console.log(this.sound) - } + constructor(doc: any) {} } interface AnimalDAO { diff --git a/types/nedb/nedb-tests.ts b/types/nedb/nedb-tests.ts index 96c5e9f154..c1ba5459cd 100644 --- a/types/nedb/nedb-tests.ts +++ b/types/nedb/nedb-tests.ts @@ -7,7 +7,7 @@ import * as es6styleimport from 'nedb'; import nedb = require('nedb'); class BaseCollection { - private dataStore: nedb; + private readonly dataStore: nedb; constructor(dataStore: nedb) { this.dataStore = dataStore; diff --git a/types/ng-cordova/test/appAvailability.ts b/types/ng-cordova/test/appAvailability.ts index 6c0391792b..aabd90ab9c 100644 --- a/types/ng-cordova/test/appAvailability.ts +++ b/types/ng-cordova/test/appAvailability.ts @@ -17,8 +17,8 @@ namespace demo.appavailability { static $inject:Array = ["$ionicPlatform", "$cordovaDevice", "$cordovaAppAvailability"]; constructor($ionicPlatform:ionic.platform.IonicPlatformService, - private $cordovaDevice:ngCordova.IDeviceService, - private $cordovaAppAvailability:ngCordova.IAppAvailabilityService) { + private readonly $cordovaDevice:ngCordova.IDeviceService, + private readonly $cordovaAppAvailability:ngCordova.IAppAvailabilityService) { this.isAvailable = false; diff --git a/types/ng-cordova/test/deviceMotion.ts b/types/ng-cordova/test/deviceMotion.ts index a93f42152b..31b825525d 100644 --- a/types/ng-cordova/test/deviceMotion.ts +++ b/types/ng-cordova/test/deviceMotion.ts @@ -11,7 +11,7 @@ namespace demo.devicemotion { msg:string; static $inject:Array = ["$ionicPlatform", "$cordovaDeviceMotion"]; - constructor($ionicPlatform:ionic.platform.IonicPlatformService, private $cordovaDeviceMotion:ngCordova.IDeviceMotionService) { + constructor($ionicPlatform:ionic.platform.IonicPlatformService, private readonly $cordovaDeviceMotion:ngCordova.IDeviceMotionService) { $ionicPlatform.ready(() => { this.getAcceleration(); }); diff --git a/types/ng-cordova/test/deviceOrientation.ts b/types/ng-cordova/test/deviceOrientation.ts index eadcdcb234..56a8efee88 100644 --- a/types/ng-cordova/test/deviceOrientation.ts +++ b/types/ng-cordova/test/deviceOrientation.ts @@ -12,8 +12,8 @@ namespace demo.deviceorientation { static $inject:Array = ["$ionicPlatform", "$timeout", "$cordovaDeviceOrientation"]; constructor($ionicPlatform:ionic.platform.IonicPlatformService, - private $timeout:ng.ITimeoutService, - private $cordovaDeviceOrientation:ngCordova.IDeviceOrientationService) { + private readonly $timeout:ng.ITimeoutService, + private readonly $cordovaDeviceOrientation:ngCordova.IDeviceOrientationService) { $ionicPlatform.ready(() => { this.getHeading(); diff --git a/types/ng-cordova/test/dialogs.ts b/types/ng-cordova/test/dialogs.ts index fe56cc3bc1..578d995724 100644 --- a/types/ng-cordova/test/dialogs.ts +++ b/types/ng-cordova/test/dialogs.ts @@ -9,7 +9,7 @@ namespace demo.dialog { action:string; static $inject:Array = ["$ionicPlatform", "$cordovaDialogs"]; - constructor($ionicPlatform:ionic.platform.IonicPlatformService, private $cordovaDialogs:ngCordova.IDialogsService) { + constructor($ionicPlatform:ionic.platform.IonicPlatformService, private readonly $cordovaDialogs:ngCordova.IDialogsService) { this.action = "Press any button !"; } diff --git a/types/ng-cordova/test/geolocation.ts b/types/ng-cordova/test/geolocation.ts index 34a67c9b00..63879867ac 100644 --- a/types/ng-cordova/test/geolocation.ts +++ b/types/ng-cordova/test/geolocation.ts @@ -10,7 +10,7 @@ namespace demo.geolocation { position:ngCordova.IGeoPosition; static $inject:Array = ["$ionicPlatform", "$cordovaGeolocation"]; - constructor($ionicPlatform:ionic.platform.IonicPlatformService, private $cordovaGeolocation:ngCordova.IGeolocationService) { + constructor($ionicPlatform:ionic.platform.IonicPlatformService, private readonly $cordovaGeolocation:ngCordova.IGeolocationService) { } diff --git a/types/ng-cordova/test/network.ts b/types/ng-cordova/test/network.ts index dde727237b..e7bb18f6ac 100644 --- a/types/ng-cordova/test/network.ts +++ b/types/ng-cordova/test/network.ts @@ -12,7 +12,7 @@ namespace demo.network { static $inject:Array = ["$ionicPlatform", "$cordovaNetwork"]; - constructor($ionicPlatform:ionic.platform.IonicPlatformService, private $cordovaNetwork:ngCordova.INetworkInformationService) { + constructor($ionicPlatform:ionic.platform.IonicPlatformService, private readonly $cordovaNetwork:ngCordova.INetworkInformationService) { $ionicPlatform.ready(() => { this.refresh(); diff --git a/types/ng-cordova/test/toast.ts b/types/ng-cordova/test/toast.ts index 2601ad577a..a1dc1d0a6d 100644 --- a/types/ng-cordova/test/toast.ts +++ b/types/ng-cordova/test/toast.ts @@ -10,7 +10,7 @@ namespace demo.toast { msg:string; static $inject:Array = ["$cordovaToast"]; - constructor(private $cordovaToast:ngCordova.IToastService) { + constructor(private readonly $cordovaToast:ngCordova.IToastService) { } diff --git a/types/ng-file-upload/ng-file-upload-tests.ts b/types/ng-file-upload/ng-file-upload-tests.ts index 8ed2d0d115..49a62e290e 100644 --- a/types/ng-file-upload/ng-file-upload-tests.ts +++ b/types/ng-file-upload/ng-file-upload-tests.ts @@ -7,7 +7,7 @@ let controllerId = "upload"; class UploadController { static $inject = ["Upload"]; - constructor(private Upload: angular.angularFileUpload.IUploadService) { + constructor(private readonly Upload: angular.angularFileUpload.IUploadService) { this.Upload.setDefaults({ ngfAccept: "image/*", ngfAllowDir: true, diff --git a/types/ng-stomp/ng-stomp-tests.ts b/types/ng-stomp/ng-stomp-tests.ts index 436fe901ea..dd5cdafa24 100644 --- a/types/ng-stomp/ng-stomp-tests.ts +++ b/types/ng-stomp/ng-stomp-tests.ts @@ -1,5 +1,5 @@ class test { - constructor(private ngstomp: ngStomp) { + constructor(private readonly ngstomp: ngStomp) { const connectHeaders = { Auth: "user", Accept: "lol" diff --git a/types/ngbootbox/ngbootbox-tests.ts b/types/ngbootbox/ngbootbox-tests.ts index e38995bcd7..4e40e7438c 100644 --- a/types/ngbootbox/ngbootbox-tests.ts +++ b/types/ngbootbox/ngbootbox-tests.ts @@ -3,7 +3,7 @@ class TestBootboxController { - constructor(private $scope: angular.IScope, $ngBootbox: BootboxService) { + constructor(private readonly $scope: angular.IScope, $ngBootbox: BootboxService) { $ngBootbox.alert('An important message!').then(function() { console.log('Alert closed'); @@ -29,15 +29,15 @@ class TestBootboxController { warning: { label: "Cancel", className: "btn-warning", - callback: function() { + callback: function() { console.log('warning callback'); } }, success: { label: "Ok", className: "btn-success", - callback: function() { - console.log('sucess callback'); + callback: function() { + console.log('sucess callback'); } } } diff --git a/types/openui5/openui5-tests.ts b/types/openui5/openui5-tests.ts index bb411a9a1e..495a2a8ed5 100644 --- a/types/openui5/openui5-tests.ts +++ b/types/openui5/openui5-tests.ts @@ -11,7 +11,7 @@ sap.ui.getCore().attachInit(function () { }); class Ctrl extends sap.ui.core.mvc.Controller { - constructor(private JSONModel: typeof sap.ui.model.json.JSONModel) { + constructor(private readonly JSONModel: typeof sap.ui.model.json.JSONModel) { super(undefined); } diff --git a/types/p-queue/p-queue-tests.ts b/types/p-queue/p-queue-tests.ts index 6a63e9e607..8c54953a73 100644 --- a/types/p-queue/p-queue-tests.ts +++ b/types/p-queue/p-queue-tests.ts @@ -21,7 +21,7 @@ num = queue.size; num = queue.pending; class QueueClass implements PQueue.QueueClass<{ any: string }> { - private queue: Array<() => void>; + private readonly queue: Array<() => void>; size = 0; diff --git a/types/pixi.js/tslint.json b/types/pixi.js/tslint.json index 590b9da845..01be0cd9ee 100644 --- a/types/pixi.js/tslint.json +++ b/types/pixi.js/tslint.json @@ -17,6 +17,7 @@ "no-unnecessary-qualifier": false, "one-line": false, "prefer-conditional-expression": false, + "prefer-readonly": false, "unified-signatures": false, "class-name": true, diff --git a/types/q/q-tests.ts b/types/q/q-tests.ts index aedacef09c..8489625736 100644 --- a/types/q/q-tests.ts +++ b/types/q/q-tests.ts @@ -153,7 +153,7 @@ Q.nfbind(nodeStyle)('foo').done((result: string) => { }); class Repo { - private items: any[] = [ + private readonly items: any[] = [ {name: 'Max', cute: false}, {name: 'Annie', cute: true} ]; diff --git a/types/q/v0/q-tests.ts b/types/q/v0/q-tests.ts index 9bd95a77c8..7fb1e7e88d 100644 --- a/types/q/v0/q-tests.ts +++ b/types/q/v0/q-tests.ts @@ -144,7 +144,7 @@ Q.nfbind(nodeStyle)('foo').done((result: string) => {}); class Repo { - private items: any[] = [ + private readonly items: any[] = [ { name: 'Max', cute: false }, { name: 'Annie', cute: true } ]; diff --git a/types/rc-select/rc-select-tests.ts b/types/rc-select/rc-select-tests.ts index 5416919a6f..990c04639a 100644 --- a/types/rc-select/rc-select-tests.ts +++ b/types/rc-select/rc-select-tests.ts @@ -16,7 +16,7 @@ class Component extends React.Component { console.log('input changed'); } - private defaultSelectProps = { + private readonly defaultSelectProps = { className: "my-select", prefixCls: "prefix", animation: "slide-up", @@ -41,13 +41,13 @@ class Component extends React.Component { defaultActiveFirstOption: false }; - private defaultOptGroupProps = { + private readonly defaultOptGroupProps = { label: "Option group", key: "option-group-0", value: "option-group-0" }; - private defaultOptionProps = { + private readonly defaultOptionProps = { className: "option", disabled: true, key: "option-0", diff --git a/types/react-dnd-html5-backend/react-dnd-html5-backend-tests.ts b/types/react-dnd-html5-backend/react-dnd-html5-backend-tests.ts index 14463a0440..71a0d06039 100644 --- a/types/react-dnd-html5-backend/react-dnd-html5-backend-tests.ts +++ b/types/react-dnd-html5-backend/react-dnd-html5-backend-tests.ts @@ -154,7 +154,7 @@ namespace BoardSquare { export class BoardSquare extends React.Component { static defaultProps: BoardSquareP; - private _renderOverlay = (color: string) => { + private readonly _renderOverlay = (color: string) => { return r.div({ style: { position: 'absolute', @@ -231,7 +231,7 @@ namespace Board { } export class Board extends React.Component { - private _renderPiece = (x: number, y: number) => { + private readonly _renderPiece = (x: number, y: number) => { const knightX = this.props.knightPosition[0]; const knightY = this.props.knightPosition[1]; return x === knightX && y === knightY ? @@ -239,7 +239,7 @@ namespace Board { null; } - private _renderSquare = (i: number) => { + private readonly _renderSquare = (i: number) => { const x = i % 8; const y = Math.floor(i / 8); diff --git a/types/react-dnd/react-dnd-tests.tsx b/types/react-dnd/react-dnd-tests.tsx index 76d732f268..3016a3f523 100644 --- a/types/react-dnd/react-dnd-tests.tsx +++ b/types/react-dnd/react-dnd-tests.tsx @@ -167,7 +167,7 @@ namespace BoardSquare { export class BoardSquare extends React.Component { static defaultProps: BoardSquareP; - private _renderOverlay = (color: string) => { + private readonly _renderOverlay = (color: string) => { return r.div({ style: { position: 'absolute', @@ -247,7 +247,7 @@ namespace Board { } export class Board extends React.Component { - private _renderPiece = (x: number, y: number) => { + private readonly _renderPiece = (x: number, y: number) => { var knightX = this.props.knightPosition[0]; var knightY = this.props.knightPosition[1]; return x === knightX && y === knightY ? @@ -255,7 +255,7 @@ namespace Board { null; }; - private _renderSquare = (i: number) => { + private readonly _renderSquare = (i: number) => { var x = i % 8; var y = Math.floor(i / 8); diff --git a/types/react-hamburger-menu/react-hamburger-menu-tests.tsx b/types/react-hamburger-menu/react-hamburger-menu-tests.tsx index d9a6b34463..dd0f6e20d3 100644 --- a/types/react-hamburger-menu/react-hamburger-menu-tests.tsx +++ b/types/react-hamburger-menu/react-hamburger-menu-tests.tsx @@ -19,7 +19,7 @@ export class ReactHamburgerMenuTest extends React.PureComponent<{}, State> { return ; } - private menuClicked = (): void => this.setState({isOpen: !this.state.isOpen}); + private readonly menuClicked = (): void => this.setState({isOpen: !this.state.isOpen}); } interface State { diff --git a/types/react-intl/v1/react-intl-tests.tsx b/types/react-intl/v1/react-intl-tests.tsx index 298f05f6ed..a75b95c202 100644 --- a/types/react-intl/v1/react-intl-tests.tsx +++ b/types/react-intl/v1/react-intl-tests.tsx @@ -33,7 +33,7 @@ namespace I18nDirect { class I18nDirect extends React.Component { - private _currentLocale: string + private readonly _currentLocale: string private _messages: {[key: string]: string} constructor( props: I18nDirect.Props ) { @@ -69,7 +69,7 @@ class I18nDirect extends React.Component { } - private compileMessages = (props: I18nDirect.Props): void => { + private readonly compileMessages = (props: I18nDirect.Props): void => { let locale: string = ( props.locales && props.locales[ 0 ] ) || 'en-US' @@ -104,7 +104,7 @@ namespace I18nMixin { @reactMixin.decorate( IntlMixin ) class I18nMixin extends React.Component implements IntlComponent { - private _currentLocale: string + private readonly _currentLocale: string constructor( props: I18nMixin.Props ) { super( props ) diff --git a/types/react-native-drawer-layout/react-native-drawer-layout-tests.tsx b/types/react-native-drawer-layout/react-native-drawer-layout-tests.tsx index d1a8c31168..c194756333 100644 --- a/types/react-native-drawer-layout/react-native-drawer-layout-tests.tsx +++ b/types/react-native-drawer-layout/react-native-drawer-layout-tests.tsx @@ -11,11 +11,11 @@ class DrawerTest extends React.Component<{}, DrawerTestState> { open: false }; - private onOpen = () => this.setState({ open: true }); + private readonly onOpen = () => this.setState({ open: true }); - private onClose = () => this.setState({ open: false }); + private readonly onClose = () => this.setState({ open: false }); - private renderNavigationView = () => ( + private readonly renderNavigationView = () => ( Drawer content diff --git a/types/react-native-drawer/react-native-drawer-tests.tsx b/types/react-native-drawer/react-native-drawer-tests.tsx index dbc1d06b0e..10aa1991bd 100644 --- a/types/react-native-drawer/react-native-drawer-tests.tsx +++ b/types/react-native-drawer/react-native-drawer-tests.tsx @@ -30,11 +30,11 @@ class DrawerTest extends React.Component<{}, {open: boolean}> { ); } - private onOpen = () => { + private readonly onOpen = () => { this.setState({open: true}); } - private onClose = () => { + private readonly onClose = () => { this.setState({open: false}); } } diff --git a/types/react-native-snap-carousel/react-native-snap-carousel-tests.tsx b/types/react-native-snap-carousel/react-native-snap-carousel-tests.tsx index b89129fd93..5edbd84389 100644 --- a/types/react-native-snap-carousel/react-native-snap-carousel-tests.tsx +++ b/types/react-native-snap-carousel/react-native-snap-carousel-tests.tsx @@ -46,15 +46,15 @@ class SnapCarouselTest extends React.Component { ); } - private onSnapToItem = (index: number) => { + private readonly onSnapToItem = (index: number) => { console.log("Snapped to: ", index); } - private onScroll = (event: NativeSyntheticEvent) => { + private readonly onScroll = (event: NativeSyntheticEvent) => { console.log("Scrolled: ", event); } - private onLayout = (event: LayoutChangeEvent) => { + private readonly onLayout = (event: LayoutChangeEvent) => { console.log("Layout: ", event); } } diff --git a/types/react-navigation/react-navigation-tests.tsx b/types/react-navigation/react-navigation-tests.tsx index 619c07c545..aca3f1bcf6 100644 --- a/types/react-navigation/react-navigation-tests.tsx +++ b/types/react-navigation/react-navigation-tests.tsx @@ -62,7 +62,7 @@ class StartScreen extends React.Component ); } - private navigateToNextScreen = (): void => { + private readonly navigateToNextScreen = (): void => { const params: NextScreenNavigationParams = { id: this.props.navigation.state.params.id, name: this.props.navigation.state.params.s, diff --git a/types/react-router/test/NavigateWithContext.tsx b/types/react-router/test/NavigateWithContext.tsx index cd6f45d232..7ab89b2e0d 100644 --- a/types/react-router/test/NavigateWithContext.tsx +++ b/types/react-router/test/NavigateWithContext.tsx @@ -19,7 +19,7 @@ class ComponentThatUsesContext extends React.Component { router: PropTypes.object.isRequired }; context: RouterChildContext; - private onClick = () => { + private readonly onClick = () => { const { history, route: { diff --git a/types/react-select/react-select-tests.tsx b/types/react-select/react-select-tests.tsx index 000042c1d0..f53f905c9b 100644 --- a/types/react-select/react-select-tests.tsx +++ b/types/react-select/react-select-tests.tsx @@ -114,7 +114,7 @@ describe("react-select", () => { it("Focus method", () => { class Component extends React.PureComponent { - private selectRef = (component: ReactSelect) => { + private readonly selectRef = (component: ReactSelect) => { component.focus(); } @@ -171,7 +171,7 @@ describe("Focus events", () => { describe("Examples", () => { it("Simple example", () => { class Component extends React.Component { - private onSelectChange: ReactSelectModule.OnChangeSingleHandler = (option) => { + private readonly onSelectChange: ReactSelectModule.OnChangeSingleHandler = (option) => { const optionValue: string = option.value; } @@ -187,7 +187,7 @@ describe("Examples", () => { it("onValueClick", () => { class Component extends React.Component { - private onValueClick: ReactSelectModule.OnValueClickHandler = (option) => { + private readonly onValueClick: ReactSelectModule.OnValueClickHandler = (option) => { const optionValue: number = option.value; } @@ -208,7 +208,7 @@ describe("Examples", () => { it("Custom value onValueClick", () => { class Component extends React.Component { - private onValueClick: ReactSelectModule.OnValueClickHandler = (option) => { + private readonly onValueClick: ReactSelectModule.OnValueClickHandler = (option) => { const optionValue: CustomValueType = option.value; } @@ -224,7 +224,7 @@ describe("Examples", () => { it("Custom value onChange", () => { class Component extends React.Component { - private onSelectChange: ReactSelectModule.OnChangeSingleHandler = (option) => { + private readonly onSelectChange: ReactSelectModule.OnChangeSingleHandler = (option) => { const optionValue: CustomValueType = option.value; } @@ -240,11 +240,11 @@ describe("Examples", () => { it("Menu renderer example", () => { class Component extends React.Component { - private onSelectChange: ReactSelectModule.OnChangeSingleHandler = option => { + private readonly onSelectChange: ReactSelectModule.OnChangeSingleHandler = option => { const optionValue: string = option.value; } - private menuRenderer: ReactSelectModule.MenuRendererHandler = props => { + private readonly menuRenderer: ReactSelectModule.MenuRendererHandler = props => { const options = props.options.map(option => { return
{option.label}
; }); @@ -265,7 +265,7 @@ describe("Examples", () => { it("Menu renderer with custom value type example", () => { class Component extends React.Component { - private menuRenderer: ReactSelectModule.MenuRendererHandler = props => { + private readonly menuRenderer: ReactSelectModule.MenuRendererHandler = props => { const options = props.options.map(option => { return (
{ it("Input render example", () => { class Component extends React.Component { - private onSelectChange: ReactSelectModule.OnChangeSingleHandler = option => { + private readonly onSelectChange: ReactSelectModule.OnChangeSingleHandler = option => { const optionValue: string = option.value; } - private inputRenderer: ReactSelectModule.InputRendererHandler = props => { + private readonly inputRenderer: ReactSelectModule.InputRendererHandler = props => { return ; } diff --git a/types/react-sortable-hoc/react-sortable-hoc-tests.tsx b/types/react-sortable-hoc/react-sortable-hoc-tests.tsx index 1d3b3d5da7..236f39b77a 100644 --- a/types/react-sortable-hoc/react-sortable-hoc-tests.tsx +++ b/types/react-sortable-hoc/react-sortable-hoc-tests.tsx @@ -33,7 +33,7 @@ const SortableList = ReactSortableHOC.SortableContainer((props: SortableListProp }); class SortableComponent extends React.Component<{}, SortableComponentState> { - private _onSortEnd: ReactSortableHOC.SortEndHandler; + private readonly _onSortEnd: ReactSortableHOC.SortEndHandler; private _handleSortEnd(sort: ReactSortableHOC.SortEnd, event: ReactSortableHOC.SortEvent): void { this.setState({items: ReactSortableHOC.arrayMove(this.state.items, sort.oldIndex, sort.newIndex)}); diff --git a/types/react-swipe/react-swipe-tests.tsx b/types/react-swipe/react-swipe-tests.tsx index c8873c8aa6..2a2f0ffc90 100644 --- a/types/react-swipe/react-swipe-tests.tsx +++ b/types/react-swipe/react-swipe-tests.tsx @@ -4,26 +4,26 @@ import * as ReactSwipe from "react-swipe"; class ReactSwipeTest extends React.PureComponent { private swipeComponent: ReactSwipe | null = null; - private onPrev: React.MouseEventHandler = () => { + private readonly onPrev: React.MouseEventHandler = () => { if (this.swipeComponent != null) { this.swipeComponent.prev(); } } - private onNext: React.MouseEventHandler = () => { + private readonly onNext: React.MouseEventHandler = () => { if (this.swipeComponent != null) { this.swipeComponent.next(); } } - private onSlideToStart: React.MouseEventHandler = () => { + private readonly onSlideToStart: React.MouseEventHandler = () => { if (this.swipeComponent != null) { const lastSlide = this.swipeComponent.getNumSlides() - 1; this.swipeComponent.slide(lastSlide, 1000); } } - private onGetCurrentPosition: React.MouseEventHandler = () => { + private readonly onGetCurrentPosition: React.MouseEventHandler = () => { const currentPosition = this.swipeComponent != null ? this.swipeComponent.getPos() : 0; alert(currentPosition); } diff --git a/types/react-swipeable/react-swipeable-tests.tsx b/types/react-swipeable/react-swipeable-tests.tsx index ed5df52e54..b31011d63d 100644 --- a/types/react-swipeable/react-swipeable-tests.tsx +++ b/types/react-swipeable/react-swipeable-tests.tsx @@ -2,18 +2,18 @@ import * as React from 'react'; import * as Swipeable from 'react-swipeable'; class SampleComponent extends React.PureComponent { - private handleSwiped: Swipeable.OnSwipedCallback = () => {}; - private handleSwiping: Swipeable.OnSwipingCallback = () => {}; - private handleSwipingUp: Swipeable.OnSwipingDirectionCallback = () => {}; - private handleSwipingRight: Swipeable.OnSwipingDirectionCallback = () => {}; - private handleSwipingDown: Swipeable.OnSwipingDirectionCallback = () => {}; - private handleSwipingLeft: Swipeable.OnSwipingDirectionCallback = () => {}; - private handleSwipedUp: Swipeable.OnSwipedDirectionCallback = () => {}; - private handleSwipedRight: Swipeable.OnSwipedDirectionCallback = () => {}; - private handleSwipedDown: Swipeable.OnSwipedDirectionCallback = () => {}; - private handleSwipedLeft: Swipeable.OnSwipedDirectionCallback = () => {}; - private handleTap: Swipeable.OnTapCallback = () => {}; - private handleClick = () => {}; + private readonly handleSwiped: Swipeable.OnSwipedCallback = () => {}; + private readonly handleSwiping: Swipeable.OnSwipingCallback = () => {}; + private readonly handleSwipingUp: Swipeable.OnSwipingDirectionCallback = () => {}; + private readonly handleSwipingRight: Swipeable.OnSwipingDirectionCallback = () => {}; + private readonly handleSwipingDown: Swipeable.OnSwipingDirectionCallback = () => {}; + private readonly handleSwipingLeft: Swipeable.OnSwipingDirectionCallback = () => {}; + private readonly handleSwipedUp: Swipeable.OnSwipedDirectionCallback = () => {}; + private readonly handleSwipedRight: Swipeable.OnSwipedDirectionCallback = () => {}; + private readonly handleSwipedDown: Swipeable.OnSwipedDirectionCallback = () => {}; + private readonly handleSwipedLeft: Swipeable.OnSwipedDirectionCallback = () => {}; + private readonly handleTap: Swipeable.OnTapCallback = () => {}; + private readonly handleClick = () => {}; render() { return ( diff --git a/types/react-touch/react-touch-tests.tsx b/types/react-touch/react-touch-tests.tsx index 4ba1f3e1ef..3a0703bb7c 100644 --- a/types/react-touch/react-touch-tests.tsx +++ b/types/react-touch/react-touch-tests.tsx @@ -25,7 +25,7 @@ export class DraggableTest extends React.PureComponent { return ; } - private callback = (argument: DraggableCallbackArgument): JSX.Element => { + private readonly callback = (argument: DraggableCallbackArgument): JSX.Element => { return
; } } @@ -44,19 +44,19 @@ export class SwipeableTest extends React.PureComponent { ; } - private swipeHandler = () => { + private readonly swipeHandler = () => { return; } } export class CustomGestureTest extends React.PureComponent { - private move: moves[] = [moves.UPLEFT, moves.RIGHT, moves.DOWNRIGHT]; + private readonly move: moves[] = [moves.UPLEFT, moves.RIGHT, moves.DOWNRIGHT]; render() { return ; } - private handler = () => { + private readonly handler = () => { return; } } diff --git a/types/react/test/index.ts b/types/react/test/index.ts index e8aabfa35c..16141fabb4 100644 --- a/types/react/test/index.ts +++ b/types/react/test/index.ts @@ -85,7 +85,7 @@ class ModernComponent extends React.Component }); } - private _myComponent: MyComponent; + private readonly _myComponent: MyComponent; private _input: HTMLInputElement | null; render() { diff --git a/types/react/v15/test/index.ts b/types/react/v15/test/index.ts index 340ea94ec2..be6d27b659 100644 --- a/types/react/v15/test/index.ts +++ b/types/react/v15/test/index.ts @@ -110,7 +110,7 @@ class ModernComponent extends React.Component }); } - private _myComponent: MyComponent; + private readonly _myComponent: MyComponent; private _input: HTMLInputElement | null; render() { diff --git a/types/reactstrap/reactstrap-tests.tsx b/types/reactstrap/reactstrap-tests.tsx index 36625681dc..2a67844f9f 100644 --- a/types/reactstrap/reactstrap-tests.tsx +++ b/types/reactstrap/reactstrap-tests.tsx @@ -3529,7 +3529,7 @@ render() { class Example115 extends React.Component { // https://reactstrap.github.io/components/carousel/ - private items = [ + private readonly items = [ { src: 'data:image/svg+xml...', altText: 'Slide 1', diff --git a/types/rot-js/rot-js-tests.ts b/types/rot-js/rot-js-tests.ts index 9a07511dce..50ec56b947 100644 --- a/types/rot-js/rot-js-tests.ts +++ b/types/rot-js/rot-js-tests.ts @@ -59,7 +59,7 @@ SHOW("%f".format(myObj)); // ---- class Item { - constructor(private name: string) { } + constructor(private readonly name: string) { } a() { const first = self.name.charAt(0); @@ -83,7 +83,7 @@ SHOW(template.format(banana, banana)); // ---- class Animal { - constructor(private name: string) { } + constructor(private readonly name: string) { } adjective(x: string) { return `${x} ${this.name}`; } diff --git a/types/rrc/rrc-tests.tsx b/types/rrc/rrc-tests.tsx index 5356cb21a6..74f15045f4 100644 --- a/types/rrc/rrc-tests.tsx +++ b/types/rrc/rrc-tests.tsx @@ -30,7 +30,7 @@ class RouteOne extends React.Component> { } class RouteTwo extends React.Component> { - private onUpdate: OnUpdateCall = (location) => { console.log("update"); }; + private readonly onUpdate: OnUpdateCall = (location) => { console.log("update"); }; render() { return
@@ -65,11 +65,11 @@ interface Params { } class RouteFour extends React.Component> { - private routes: RouteConfiguration[] = [ + private readonly routes: RouteConfiguration[] = [ { path: "/four/something/:page", component: RouteTwo } ]; - private getKey: GetKeyFunction = (match, route, location) => { + private readonly getKey: GetKeyFunction = (match, route, location) => { return "my-key-" + match.url; } diff --git a/types/screeps-profiler/screeps-profiler-tests.ts b/types/screeps-profiler/screeps-profiler-tests.ts index 009f36f256..aab28c7ad9 100644 --- a/types/screeps-profiler/screeps-profiler-tests.ts +++ b/types/screeps-profiler/screeps-profiler-tests.ts @@ -4,7 +4,7 @@ function testFunction() { } class TestClass { - private dummy: string; + private readonly dummy: string; } const testObj = { diff --git a/types/sharepoint/sharepoint-tests.ts b/types/sharepoint/sharepoint-tests.ts index 2b9bba7943..e76536cd18 100644 --- a/types/sharepoint/sharepoint-tests.ts +++ b/types/sharepoint/sharepoint-tests.ts @@ -2355,7 +2355,7 @@ namespace App { static $inject: string[] = ["$SharePoint", "$spnotify"]; - constructor(private $SharePoint: App.SharePoint, private $n: App.SpNotify) { + constructor(private readonly $SharePoint: App.SharePoint, private readonly $n: App.SpNotify) { this.activate(); } diff --git a/types/slickgrid/test/index.ts b/types/slickgrid/test/index.ts index d0ee85a23c..a0b5f178c5 100644 --- a/types/slickgrid/test/index.ts +++ b/types/slickgrid/test/index.ts @@ -62,7 +62,7 @@ $('.newSelection'); grid.setSelectedRows([0, 1, 2]); class SingleCellSelectionModel extends Slick.SelectionModel { - private self: SingleCellSelectionModel = null; + private readonly self: SingleCellSelectionModel = null; private _grid: Slick.Grid; constructor() { diff --git a/types/wallabyjs/wallabyjs-tests.ts b/types/wallabyjs/wallabyjs-tests.ts index 141e55d708..b4120d74ba 100644 --- a/types/wallabyjs/wallabyjs-tests.ts +++ b/types/wallabyjs/wallabyjs-tests.ts @@ -37,5 +37,5 @@ export class WallabyConfig implements wallabyjs.IWallabyConfig { } }; - constructor(private wallaby: wallabyjs.IWallaby) { } + constructor(private readonly wallaby: wallabyjs.IWallaby) { } } diff --git a/types/whatwg-streams/whatwg-streams-tests.ts b/types/whatwg-streams/whatwg-streams-tests.ts index 528c2f1f01..9456ff2983 100644 --- a/types/whatwg-streams/whatwg-streams-tests.ts +++ b/types/whatwg-streams/whatwg-streams-tests.ts @@ -295,7 +295,7 @@ function streamifyWebSocket(url: string, protocol: string) { } class WebSocketSource implements ReadableStreamSource { - private _ws: WebSocket; + private readonly _ws: WebSocket; constructor(ws: WebSocket) { this._ws = ws; @@ -316,7 +316,7 @@ class WebSocketSource implements ReadableStreamSource { } class WebSocketSink implements WritableStreamSink { - private _ws: WebSocket; + private readonly _ws: WebSocket; constructor(ws: WebSocket) { this._ws = ws; diff --git a/types/when/when-tests.ts b/types/when/when-tests.ts index 57523b00ac..63fbba2234 100644 --- a/types/when/when-tests.ts +++ b/types/when/when-tests.ts @@ -7,7 +7,7 @@ import dns = require('dns'); import when = require("when"); class ForeignPromise { - constructor(private value: T) { + constructor(private readonly value: T) { } then(onFulfilled: (value: T) => U, onRejected?: (reason: any) => U) { return new ForeignPromise(onFulfilled(this.value)); } diff --git a/types/yfiles/yfiles-tests.ts b/types/yfiles/yfiles-tests.ts index f05acba4a4..5d13f4de75 100644 --- a/types/yfiles/yfiles-tests.ts +++ b/types/yfiles/yfiles-tests.ts @@ -1,5 +1,5 @@ class BasicTest { - private graphComponent:yfiles.view.GraphComponent; + private readonly graphComponent:yfiles.view.GraphComponent; constructor() { this.graphComponent = new yfiles.view.GraphComponent("graphControl"); @@ -129,7 +129,7 @@ class BasicTest { var args = new yfiles.lang.EventArgs(); yfiles.input.KeyEventRecognizers.META_PRESSED(null, args); } - + testsForVersion2012() { //isInstance type-guard let r : any;