mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-12-03 11:41:44 +00:00
Merge branch 'master' of https://github.com/DefinitelyTyped/DefinitelyTyped
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
class EmployeesFactory {
|
||||
static $inject = ['$rootScope', 'Hub', '$timeout'];
|
||||
private hub: ngSignalr.Hub;
|
||||
private readonly hub: ngSignalr.Hub;
|
||||
public all: Array<Employee>;
|
||||
|
||||
constructor($rootScope: ng.IRootScopeService, Hub: ngSignalr.HubFactory, $timeout: ng.ITimeoutService) {
|
||||
|
||||
@@ -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: {}) =>
|
||||
|
||||
@@ -161,7 +161,7 @@ namespace My.Namespace {
|
||||
}
|
||||
|
||||
class TestProvider implements ng.IServiceProvider {
|
||||
constructor(private $scope: ng.IScope) {}
|
||||
constructor(private readonly $scope: ng.IScope) {}
|
||||
|
||||
$get() {}
|
||||
}
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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<string[]> {
|
||||
return new this.$q((resolve, reject) => {
|
||||
|
||||
@@ -22,10 +22,10 @@ class BraftEditorTest extends React.Component<BraftEditor.editorProps> {
|
||||
</div>
|
||||
);
|
||||
}
|
||||
private handleChange = (content: RawDraftContentState) => {
|
||||
private readonly handleChange = (content: RawDraftContentState) => {
|
||||
console.log(content);
|
||||
}
|
||||
private handleHTMLChange = (html: string) => {
|
||||
private readonly handleHTMLChange = (html: string) => {
|
||||
console.log(html);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -619,7 +619,8 @@ function chart_bar() {
|
||||
width: {
|
||||
ratio: 0.5, // this makes bar width 50% of length between ticks
|
||||
max: 50 // this limits maximum width of bar to 50px
|
||||
}
|
||||
},
|
||||
space: 10 // this adds space between bars in bar charts
|
||||
// or
|
||||
// width: 100 // this makes bar width 100px
|
||||
}
|
||||
|
||||
Vendored
+4
@@ -178,6 +178,10 @@ export interface ChartConfiguration {
|
||||
* Set if min or max value will be 0 on bar chart.
|
||||
*/
|
||||
zerobased?: boolean;
|
||||
/**
|
||||
* Set space between bars in bar charts
|
||||
*/
|
||||
space?: number;
|
||||
};
|
||||
|
||||
pie?: {
|
||||
|
||||
@@ -16,10 +16,10 @@ connect("mongodb://user:password@localhost:27017/database?authSource=admin").the
|
||||
}
|
||||
|
||||
class User extends CamoDocument<UserSchema> {
|
||||
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
|
||||
};
|
||||
|
||||
Vendored
+2
-2
@@ -1,4 +1,4 @@
|
||||
// Type definitions for Chartist v0.9.8
|
||||
// Type definitions for Chartist v0.9.81
|
||||
// Project: https://github.com/gionkunz/chartist-js
|
||||
// Definitions by: Matt Gibbs <https://github.com/mtgibbs>, Simon Pfeifer <https://github.com/psimonski>, Cassey Lottman <https://github.com/clottman>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
@@ -78,7 +78,7 @@ declare namespace Chartist {
|
||||
// TODO: come in and tidy this up and make it fit better
|
||||
interface IChartistData {
|
||||
labels?: Array<string> | Array<number> | Array<Date>;
|
||||
series: Array<IChartistSeriesData> | Array<number> | Array<Array<number>>;
|
||||
series: Array<IChartistSeriesData> | Array<Array<IChartistData>> | Array<number> | Array<Array<number>>;
|
||||
}
|
||||
|
||||
interface IChartistSeriesData {
|
||||
|
||||
@@ -4,6 +4,11 @@
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"paths": {
|
||||
"mongodb": [
|
||||
"mongodb/v2"
|
||||
]
|
||||
},
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -205,9 +205,9 @@ class Circulator {
|
||||
return d ? d : [0, 0];
|
||||
});
|
||||
}
|
||||
private r: number;
|
||||
private p: number;
|
||||
private circleGenerator: d3Geo.GeoCircleGenerator<Circulator, [number, number] | undefined>;
|
||||
private readonly r: number;
|
||||
private readonly p: number;
|
||||
private readonly circleGenerator: d3Geo.GeoCircleGenerator<Circulator, [number, number] | undefined>;
|
||||
|
||||
getCirclePolygon(center?: [number, number]): GeoJSON.Polygon {
|
||||
if (center && center.length === 2 && typeof center[0] === 'number' && typeof center[1] === 'number') {
|
||||
|
||||
@@ -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<Arcer, ArcerDatum>;
|
||||
private readonly arc: d3Shape.Arc<Arcer, ArcerDatum>;
|
||||
|
||||
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<Symbolizer, SymbolDatum>;
|
||||
private readonly size: number;
|
||||
private readonly type: d3Shape.SymbolType;
|
||||
private readonly symbol: d3Shape.Symbol<Symbolizer, SymbolDatum>;
|
||||
|
||||
getPathString(d?: SymbolDatum) {
|
||||
return d ? this.symbol(d) : this.symbol();
|
||||
|
||||
@@ -614,7 +614,7 @@ function updateSproc(id: string, update: Object) {
|
||||
} else if (document[existingFieldName]) {
|
||||
// If the field exists, set/overwrite the new field name and unset the existing field name.
|
||||
document[newFieldName] = document[existingFieldName];
|
||||
delete document[existingFieldName];
|
||||
delete document[existingFieldName]; // tslint:disable-line no-dynamic-delete
|
||||
} else {
|
||||
// Otherwise this is a noop.
|
||||
}
|
||||
@@ -641,7 +641,7 @@ function updateSproc(id: string, update: Object) {
|
||||
if (update.$unset) {
|
||||
fields = Object.keys(update.$unset);
|
||||
for (i = 0; i < fields.length; i++) {
|
||||
delete document[fields[i]];
|
||||
delete document[fields[i]]; // tslint:disable-line no-dynamic-delete
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,8 +38,6 @@ else { // if not an array but scalar value here is a way how to convert to array
|
||||
|
||||
// The way to remove the parameter:
|
||||
delete u.query.a;
|
||||
// or:
|
||||
delete u.query["a"];
|
||||
|
||||
// If you need to remove all query string params:
|
||||
console.log(u.clearQuery());
|
||||
|
||||
@@ -4,6 +4,11 @@
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"paths": {
|
||||
"mongodb": [
|
||||
"mongodb/v2"
|
||||
]
|
||||
},
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
|
||||
@@ -14,7 +14,7 @@ enum Any {
|
||||
}
|
||||
|
||||
class Monster2 {
|
||||
bb: flatbuffers.ByteBuffer= null;
|
||||
bb: flatbuffers.ByteBuffer = null;
|
||||
|
||||
bb_pos = 0;
|
||||
|
||||
@@ -89,7 +89,7 @@ class Test {
|
||||
}
|
||||
|
||||
class TestSimpleTableWithEnum {
|
||||
bb: flatbuffers.ByteBuffer= null;
|
||||
bb: flatbuffers.ByteBuffer = null;
|
||||
|
||||
bb_pos = 0;
|
||||
|
||||
@@ -134,7 +134,7 @@ class TestSimpleTableWithEnum {
|
||||
}
|
||||
|
||||
class Vec3 {
|
||||
bb: flatbuffers.ByteBuffer= null;
|
||||
bb: flatbuffers.ByteBuffer = null;
|
||||
|
||||
bb_pos = 0;
|
||||
|
||||
@@ -242,7 +242,7 @@ class Vec3 {
|
||||
}
|
||||
|
||||
class Stat {
|
||||
bb: flatbuffers.ByteBuffer= null;
|
||||
bb: flatbuffers.ByteBuffer = null;
|
||||
|
||||
bb_pos = 0;
|
||||
|
||||
@@ -305,7 +305,7 @@ class Stat {
|
||||
}
|
||||
|
||||
class Monster {
|
||||
bb: flatbuffers.ByteBuffer= null;
|
||||
bb: flatbuffers.ByteBuffer = null;
|
||||
|
||||
bb_pos = 0;
|
||||
|
||||
|
||||
@@ -40,9 +40,6 @@ export class TestStorage {
|
||||
// import Storage class
|
||||
static gcs = CloudStorage();
|
||||
|
||||
// the bucket
|
||||
private buckets: Bucket[] = [];
|
||||
|
||||
constructor() {
|
||||
// nothing to do
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
Vendored
+1
@@ -9,6 +9,7 @@
|
||||
// Ivan Goncharov <https://github.com/IvanGoncharov>
|
||||
// Hagai Cohen <https://github.com/DxCx>
|
||||
// Ricardo Portugal <https://github.com/rportugal>
|
||||
// Tim Griesser <https://github.com/tgriesser>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
|
||||
Vendored
+8
-8
@@ -262,9 +262,9 @@ export type GraphQLIsTypeOfFn<TSource, TContext> = (
|
||||
info: GraphQLResolveInfo
|
||||
) => boolean | Promise<boolean>;
|
||||
|
||||
export type GraphQLFieldResolver<TSource, TContext> = (
|
||||
export type GraphQLFieldResolver<TSource, TContext, TArgs = { [argName: string]: any }> = (
|
||||
source: TSource,
|
||||
args: { [argName: string]: any },
|
||||
args: TArgs,
|
||||
context: TContext,
|
||||
info: GraphQLResolveInfo
|
||||
) => any;
|
||||
@@ -284,11 +284,11 @@ export interface GraphQLResolveInfo {
|
||||
|
||||
export type ResponsePath = { prev: ResponsePath, key: string | number } | undefined;
|
||||
|
||||
export interface GraphQLFieldConfig<TSource, TContext> {
|
||||
export interface GraphQLFieldConfig<TSource, TContext, TArgs = { [argName: string]: any }> {
|
||||
type: GraphQLOutputType;
|
||||
args?: GraphQLFieldConfigArgumentMap;
|
||||
resolve?: GraphQLFieldResolver<TSource, TContext>;
|
||||
subscribe?: GraphQLFieldResolver<TSource, TContext>;
|
||||
resolve?: GraphQLFieldResolver<TSource, TContext, TArgs>;
|
||||
subscribe?: GraphQLFieldResolver<TSource, TContext, TArgs>;
|
||||
deprecationReason?: string;
|
||||
description?: string;
|
||||
astNode?: FieldDefinitionNode;
|
||||
@@ -309,13 +309,13 @@ export interface GraphQLFieldConfigMap<TSource, TContext> {
|
||||
[fieldName: string]: GraphQLFieldConfig<TSource, TContext>;
|
||||
}
|
||||
|
||||
export interface GraphQLField<TSource, TContext> {
|
||||
export interface GraphQLField<TSource, TContext, TArgs = { [argName: string]: any }> {
|
||||
name: string;
|
||||
description: string;
|
||||
type: GraphQLOutputType;
|
||||
args: GraphQLArgument[];
|
||||
resolve?: GraphQLFieldResolver<TSource, TContext>;
|
||||
subscribe?: GraphQLFieldResolver<TSource, TContext>;
|
||||
resolve?: GraphQLFieldResolver<TSource, TContext, TArgs>;
|
||||
subscribe?: GraphQLFieldResolver<TSource, TContext, TArgs>;
|
||||
isDeprecated?: boolean;
|
||||
deprecationReason?: string;
|
||||
astNode?: FieldDefinitionNode;
|
||||
|
||||
Vendored
+1
@@ -2,6 +2,7 @@
|
||||
// Project: https://github.com/beatgammit/gzip-js
|
||||
// Definitions by: rhysd <https://github.com/rhysd>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.1
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
|
||||
@@ -288,7 +288,7 @@ describe('missing tests', () => {
|
||||
class Closure<T> {
|
||||
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 ""; }
|
||||
}
|
||||
|
||||
|
||||
@@ -183,7 +183,7 @@ describe('missing tests', function () {
|
||||
class Closure<T> {
|
||||
private arg: T;
|
||||
|
||||
public constructor(private fn: (arg: T) => void) {
|
||||
public constructor(private readonly fn: (arg: T) => void) {
|
||||
this.fn = fn;
|
||||
}
|
||||
|
||||
|
||||
@@ -40,8 +40,6 @@ else { // if not an array but scalar value here is a way how to convert to array
|
||||
|
||||
// The way to remove the parameter:
|
||||
delete u.query.a
|
||||
// or:
|
||||
delete u.query["a"]
|
||||
|
||||
// If you need to remove all query string params:
|
||||
u.query.clear();
|
||||
|
||||
@@ -90,7 +90,7 @@ function test_computed() {
|
||||
}
|
||||
|
||||
class GetterViewModel {
|
||||
private _selectedRange: KnockoutObservable<any>;
|
||||
private readonly _selectedRange: KnockoutObservable<any>;
|
||||
|
||||
constructor() {
|
||||
this._selectedRange = ko.observable();
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
class Server implements App {
|
||||
private usersPlaying: { [nick: string]: number } = {};
|
||||
private readonly usersPlaying = new Map<string, number>();
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Vendored
+307
-354
File diff suppressed because it is too large
Load Diff
@@ -2,72 +2,72 @@
|
||||
import mongodb = require('mongodb');
|
||||
var MongoClient = mongodb.MongoClient;
|
||||
|
||||
var format = require('util').format;
|
||||
var format = require('util').format;
|
||||
let options: mongodb.MongoClientOptions = {
|
||||
authSource : ' ',
|
||||
w : 1,
|
||||
wtimeout : 300,
|
||||
j : true,
|
||||
bufferMaxEntries : 1000,
|
||||
readPreference : 'ReadPreference | string',
|
||||
promoteValues : {},
|
||||
pkFactory : {},
|
||||
poolSize : 1,
|
||||
authSource: ' ',
|
||||
w: 1,
|
||||
wtimeout: 300,
|
||||
j: true,
|
||||
bufferMaxEntries: 1000,
|
||||
readPreference: 'ReadPreference | string',
|
||||
promoteValues: {},
|
||||
pkFactory: {},
|
||||
poolSize: 1,
|
||||
|
||||
socketOptions : {},
|
||||
socketOptions: {},
|
||||
|
||||
reconnectTries : 123456,
|
||||
reconnectInterval : 123456,
|
||||
reconnectTries: 123456,
|
||||
reconnectInterval: 123456,
|
||||
|
||||
ssl : true,
|
||||
sslValidate : {},
|
||||
checkServerIdentity : function (){ },
|
||||
sslCA : ['str'],
|
||||
sslCert : new Buffer(999),
|
||||
sslKey : new Buffer(999),
|
||||
sslPass : new Buffer(999)
|
||||
ssl: true,
|
||||
sslValidate: {},
|
||||
checkServerIdentity: function () { },
|
||||
sslCA: ['str'],
|
||||
sslCert: new Buffer(999),
|
||||
sslKey: new Buffer(999),
|
||||
sslPass: new Buffer(999)
|
||||
}
|
||||
MongoClient.connect('mongodb://127.0.0.1:27017/test', options, function(err: mongodb.MongoError, db: mongodb.Db) {
|
||||
MongoClient.connect('mongodb://127.0.0.1:27017/test', options, function (err: mongodb.MongoError, client: mongodb.MongoClient) {
|
||||
if (err) throw err;
|
||||
|
||||
const db = client.db('test');
|
||||
var collection = db.collection('test_insert');
|
||||
collection.insertOne({ a: 2 }, function(err: mongodb.MongoError, docs: any) {
|
||||
collection.insertOne({ a: 2 }, function (err: mongodb.MongoError, docs: any) {
|
||||
|
||||
collection.count(function(err: mongodb.MongoError, count: any) {
|
||||
collection.count(function (err: mongodb.MongoError, count: any) {
|
||||
console.log(format("count = %s", count));
|
||||
});
|
||||
|
||||
// Locate all the entries using find
|
||||
collection.find({}).toArray(function(err: mongodb.MongoError, results: any) {
|
||||
collection.find({}).toArray(function (err: mongodb.MongoError, results: any) {
|
||||
console.dir(results);
|
||||
// Let's close the db
|
||||
db.close();
|
||||
client.close();
|
||||
});
|
||||
|
||||
// Get some statistics
|
||||
collection.stats(function(err: mongodb.MongoError, stats: any) {
|
||||
collection.stats(function (err: mongodb.MongoError, stats: any) {
|
||||
console.log(stats.count + " documents");
|
||||
});
|
||||
|
||||
//
|
||||
collection.stats().then(function(stats){
|
||||
collection.stats().then(function (stats) {
|
||||
console.log(stats.wiredTiger.cache['bytes currently in the cache']);
|
||||
})
|
||||
|
||||
collection.createIndex({}, {partialFilterExpression: {rating: {$exists: 1}}})
|
||||
collection.createIndex({}, { partialFilterExpression: { rating: { $exists: 1 } } })
|
||||
});
|
||||
|
||||
{
|
||||
let cursor: mongodb.Cursor;
|
||||
let cursor: mongodb.Cursor;
|
||||
cursor = collection.find();
|
||||
cursor = cursor.addCursorFlag('',true);
|
||||
cursor = cursor.addQueryModifier('',true);
|
||||
cursor = cursor.addCursorFlag('', true);
|
||||
cursor = cursor.addQueryModifier('', true);
|
||||
cursor = cursor.batchSize(1);
|
||||
cursor = cursor.comment('');
|
||||
cursor = cursor.filter(1);
|
||||
cursor = cursor.hint({});
|
||||
cursor = cursor.limit(1);
|
||||
cursor = cursor.map(function (result) {});
|
||||
cursor = cursor.map(function (result) { });
|
||||
cursor = cursor.max(1);
|
||||
cursor = cursor.min(1);
|
||||
cursor = cursor.maxAwaitTimeMS(1);
|
||||
@@ -75,7 +75,7 @@ let options: mongodb.MongoClientOptions = {
|
||||
cursor = cursor.maxTimeMS(1);
|
||||
cursor = cursor.project({});
|
||||
cursor = cursor.returnKey({});
|
||||
cursor = cursor.setCursorOption('',{});
|
||||
cursor = cursor.setCursorOption('', {});
|
||||
cursor = cursor.setReadPreference('');
|
||||
cursor = cursor.showRecordId({});
|
||||
cursor = cursor.skip(1);
|
||||
@@ -85,17 +85,17 @@ let options: mongodb.MongoClientOptions = {
|
||||
}
|
||||
// Collection .findM<T>() & .agggregate<T>() generic tests
|
||||
{
|
||||
let bag : {cost: number, color: string};
|
||||
type bag = typeof bag;
|
||||
let cursor: mongodb.Cursor<bag> = collection.find<bag>({color: 'black'})
|
||||
cursor.toArray(function (err,r) { r[0].cost} );
|
||||
cursor.forEach(function (bag ) { bag.color }, () => {});
|
||||
collection.findOne({ color: 'white' }).then(b => { let _b:bag = b; })
|
||||
let bag: { cost: number, color: string };
|
||||
type bag = typeof bag;
|
||||
let cursor: mongodb.Cursor<bag> = collection.find<bag>({ color: 'black' })
|
||||
cursor.toArray(function (err, r) { r[0].cost });
|
||||
cursor.forEach(function (bag) { bag.color }, () => { });
|
||||
collection.findOne({ color: 'white' }).then(b => { let _b: bag = b; })
|
||||
collection.findOne<bag>({ color: 'white' }).then(b => { b.cost; })
|
||||
}
|
||||
{
|
||||
let payment: {total: number};
|
||||
type payment = typeof payment;
|
||||
let cursor: mongodb.AggregationCursor<payment> = collection.aggregate<payment>([{}])
|
||||
let payment: { total: number };
|
||||
type payment = typeof payment;
|
||||
let cursor: mongodb.AggregationCursor<payment> = collection.aggregate<payment>([{}])
|
||||
}
|
||||
})
|
||||
|
||||
Vendored
+1435
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,101 @@
|
||||
// Test source : https://github.com/mongodb/node-mongodb-native
|
||||
import mongodb = require('mongodb');
|
||||
var MongoClient = mongodb.MongoClient;
|
||||
|
||||
var format = require('util').format;
|
||||
let options: mongodb.MongoClientOptions = {
|
||||
authSource : ' ',
|
||||
w : 1,
|
||||
wtimeout : 300,
|
||||
j : true,
|
||||
bufferMaxEntries : 1000,
|
||||
readPreference : 'ReadPreference | string',
|
||||
promoteValues : {},
|
||||
pkFactory : {},
|
||||
poolSize : 1,
|
||||
|
||||
socketOptions : {},
|
||||
|
||||
reconnectTries : 123456,
|
||||
reconnectInterval : 123456,
|
||||
|
||||
ssl : true,
|
||||
sslValidate : {},
|
||||
checkServerIdentity : function (){ },
|
||||
sslCA : ['str'],
|
||||
sslCert : new Buffer(999),
|
||||
sslKey : new Buffer(999),
|
||||
sslPass : new Buffer(999)
|
||||
}
|
||||
MongoClient.connect('mongodb://127.0.0.1:27017/test', options, function(err: mongodb.MongoError, db: mongodb.Db) {
|
||||
if (err) throw err;
|
||||
|
||||
var collection = db.collection('test_insert');
|
||||
collection.insertOne({ a: 2 }, function(err: mongodb.MongoError, docs: any) {
|
||||
|
||||
collection.count(function(err: mongodb.MongoError, count: any) {
|
||||
console.log(format("count = %s", count));
|
||||
});
|
||||
|
||||
// Locate all the entries using find
|
||||
collection.find({}).toArray(function(err: mongodb.MongoError, results: any) {
|
||||
console.dir(results);
|
||||
// Let's close the db
|
||||
db.close();
|
||||
});
|
||||
|
||||
// Get some statistics
|
||||
collection.stats(function(err: mongodb.MongoError, stats: any) {
|
||||
console.log(stats.count + " documents");
|
||||
});
|
||||
|
||||
//
|
||||
collection.stats().then(function(stats){
|
||||
console.log(stats.wiredTiger.cache['bytes currently in the cache']);
|
||||
})
|
||||
|
||||
collection.createIndex({}, {partialFilterExpression: {rating: {$exists: 1}}})
|
||||
});
|
||||
|
||||
{
|
||||
let cursor: mongodb.Cursor;
|
||||
cursor = collection.find();
|
||||
cursor = cursor.addCursorFlag('',true);
|
||||
cursor = cursor.addQueryModifier('',true);
|
||||
cursor = cursor.batchSize(1);
|
||||
cursor = cursor.comment('');
|
||||
cursor = cursor.filter(1);
|
||||
cursor = cursor.hint({});
|
||||
cursor = cursor.limit(1);
|
||||
cursor = cursor.map(function (result) {});
|
||||
cursor = cursor.max(1);
|
||||
cursor = cursor.min(1);
|
||||
cursor = cursor.maxAwaitTimeMS(1);
|
||||
cursor = cursor.maxScan({});
|
||||
cursor = cursor.maxTimeMS(1);
|
||||
cursor = cursor.project({});
|
||||
cursor = cursor.returnKey({});
|
||||
cursor = cursor.setCursorOption('',{});
|
||||
cursor = cursor.setReadPreference('');
|
||||
cursor = cursor.showRecordId({});
|
||||
cursor = cursor.skip(1);
|
||||
cursor = cursor.snapshot({});
|
||||
cursor = cursor.sort({});
|
||||
cursor = cursor.stream();
|
||||
}
|
||||
// Collection .findM<T>() & .agggregate<T>() generic tests
|
||||
{
|
||||
let bag : {cost: number, color: string};
|
||||
type bag = typeof bag;
|
||||
let cursor: mongodb.Cursor<bag> = collection.find<bag>({color: 'black'})
|
||||
cursor.toArray(function (err,r) { r[0].cost} );
|
||||
cursor.forEach(function (bag ) { bag.color }, () => {});
|
||||
collection.findOne({ color: 'white' }).then(b => { let _b:bag = b; })
|
||||
collection.findOne<bag>({ color: 'white' }).then(b => { b.cost; })
|
||||
}
|
||||
{
|
||||
let payment: {total: number};
|
||||
type payment = typeof payment;
|
||||
let cursor: mongodb.AggregationCursor<payment> = collection.aggregate<payment>([{}])
|
||||
}
|
||||
})
|
||||
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"paths": {
|
||||
"mongodb": [
|
||||
"mongodb/v2"
|
||||
]
|
||||
},
|
||||
"noImplicitAny": false,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../../",
|
||||
"typeRoots": [
|
||||
"../../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"mongodb-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"adjacent-overload-signatures": false,
|
||||
"array-type": false,
|
||||
"arrow-return-shorthand": false,
|
||||
"ban-types": false,
|
||||
"callable-types": false,
|
||||
"comment-format": false,
|
||||
"dt-header": false,
|
||||
"eofline": false,
|
||||
"export-just-namespace": false,
|
||||
"import-spacing": false,
|
||||
"interface-name": false,
|
||||
"interface-over-type-literal": false,
|
||||
"jsdoc-format": false,
|
||||
"max-line-length": false,
|
||||
"member-access": false,
|
||||
"new-parens": false,
|
||||
"no-any-union": false,
|
||||
"no-boolean-literal-compare": false,
|
||||
"no-conditional-assignment": false,
|
||||
"no-consecutive-blank-lines": false,
|
||||
"no-construct": false,
|
||||
"no-declare-current-package": false,
|
||||
"no-duplicate-imports": false,
|
||||
"no-duplicate-variable": false,
|
||||
"no-empty-interface": false,
|
||||
"no-for-in-array": false,
|
||||
"no-inferrable-types": false,
|
||||
"no-internal-module": false,
|
||||
"no-irregular-whitespace": false,
|
||||
"no-mergeable-namespace": false,
|
||||
"no-misused-new": false,
|
||||
"no-namespace": false,
|
||||
"no-object-literal-type-assertion": false,
|
||||
"no-padding": false,
|
||||
"no-redundant-jsdoc": false,
|
||||
"no-redundant-jsdoc-2": false,
|
||||
"no-redundant-undefined": false,
|
||||
"no-reference-import": false,
|
||||
"no-relative-import-in-test": false,
|
||||
"no-self-import": false,
|
||||
"no-single-declare-module": false,
|
||||
"no-string-throw": false,
|
||||
"no-unnecessary-callback-wrapper": false,
|
||||
"no-unnecessary-class": false,
|
||||
"no-unnecessary-generics": false,
|
||||
"no-unnecessary-qualifier": false,
|
||||
"no-unnecessary-type-assertion": false,
|
||||
"no-useless-files": false,
|
||||
"no-var-keyword": false,
|
||||
"no-var-requires": false,
|
||||
"no-void-expression": false,
|
||||
"no-trailing-whitespace": false,
|
||||
"object-literal-key-quotes": false,
|
||||
"object-literal-shorthand": false,
|
||||
"one-line": false,
|
||||
"one-variable-per-declaration": false,
|
||||
"only-arrow-functions": false,
|
||||
"prefer-conditional-expression": false,
|
||||
"prefer-const": false,
|
||||
"prefer-declare-function": false,
|
||||
"prefer-for-of": false,
|
||||
"prefer-method-signature": false,
|
||||
"prefer-template": false,
|
||||
"radix": false,
|
||||
"semicolon": false,
|
||||
"space-before-function-paren": false,
|
||||
"space-within-parens": false,
|
||||
"strict-export-declare-modifiers": false,
|
||||
"trim-file": false,
|
||||
"triple-equals": false,
|
||||
"typedef-whitespace": false,
|
||||
"unified-signatures": false,
|
||||
"use-default-type-parameter": false,
|
||||
"void-return": false,
|
||||
"whitespace": false
|
||||
}
|
||||
}
|
||||
@@ -143,8 +143,8 @@ Model.findOne({ name: 'john' }, (err: any, doc: mongoose.Document) => {
|
||||
|
||||
doc.toJSON({ getters: true, virtuals: false });
|
||||
var data: any = doc.toObject();
|
||||
delete data['age'];
|
||||
delete data['weight'];
|
||||
delete data['age']; // tslint:disable-line no-dynamic-delete
|
||||
delete data['weight']; // tslint:disable-line no-dynamic-delete
|
||||
data['isAwesome'] = true;
|
||||
});
|
||||
|
||||
|
||||
@@ -4,6 +4,11 @@
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"paths": {
|
||||
"mongodb": [
|
||||
"mongodb/v2"
|
||||
]
|
||||
},
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
|
||||
@@ -7,7 +7,7 @@ import * as es6styleimport from 'nedb';
|
||||
import nedb = require('nedb');
|
||||
|
||||
class BaseCollection<T> {
|
||||
private dataStore: nedb;
|
||||
private readonly dataStore: nedb;
|
||||
|
||||
constructor(dataStore: nedb) {
|
||||
this.dataStore = dataStore;
|
||||
|
||||
@@ -17,8 +17,8 @@ namespace demo.appavailability {
|
||||
|
||||
static $inject:Array<string> = ["$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;
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace demo.devicemotion {
|
||||
msg:string;
|
||||
|
||||
static $inject:Array<string> = ["$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();
|
||||
});
|
||||
|
||||
@@ -12,8 +12,8 @@ namespace demo.deviceorientation {
|
||||
|
||||
static $inject:Array<string> = ["$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();
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace demo.dialog {
|
||||
action:string;
|
||||
|
||||
static $inject:Array<string> = ["$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 !";
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace demo.geolocation {
|
||||
position:ngCordova.IGeoPosition;
|
||||
|
||||
static $inject:Array<string> = ["$ionicPlatform", "$cordovaGeolocation"];
|
||||
constructor($ionicPlatform:ionic.platform.IonicPlatformService, private $cordovaGeolocation:ngCordova.IGeolocationService) {
|
||||
constructor($ionicPlatform:ionic.platform.IonicPlatformService, private readonly $cordovaGeolocation:ngCordova.IGeolocationService) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace demo.network {
|
||||
|
||||
static $inject:Array<string> = ["$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();
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace demo.toast {
|
||||
msg:string;
|
||||
|
||||
static $inject:Array<string> = ["$cordovaToast"];
|
||||
constructor(private $cordovaToast:ngCordova.IToastService) {
|
||||
constructor(private readonly $cordovaToast:ngCordova.IToastService) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class test {
|
||||
constructor(private ngstomp: ngStomp) {
|
||||
constructor(private readonly ngstomp: ngStomp) {
|
||||
const connectHeaders = {
|
||||
Auth: "user",
|
||||
Accept: "lol"
|
||||
|
||||
@@ -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');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+2
-4
@@ -4,10 +4,8 @@
|
||||
// Connor Schlesiger <https://github.com/schlesiger>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/* tslint:disable:max-line-length */
|
||||
|
||||
export interface NightWatchCustomPageObjects {
|
||||
page: {[name: string]: () => NightWatchBrowser};
|
||||
export interface NightwatchCustomPageObjects {
|
||||
page: {[name: string]: () => NightwatchBrowser};
|
||||
}
|
||||
|
||||
export interface NightwatchDesiredCapabilities {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
"no-unnecessary-qualifier": false,
|
||||
"one-line": false,
|
||||
"prefer-conditional-expression": false,
|
||||
"prefer-readonly": false,
|
||||
"unified-signatures": false,
|
||||
|
||||
"class-name": true,
|
||||
|
||||
Vendored
+2
-2
@@ -1,5 +1,5 @@
|
||||
// Type definitions for playcanvas 0.221.0-dev
|
||||
// Project: https://github.com/playcanvas/engine
|
||||
// Type definitions for playcanvas 0.221
|
||||
// Project: https://github.com/playcanvas/engine
|
||||
// Definitions by: Philippe Vaillancourt <https://github.com/Neoflash1979>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// create a PlayCanvas application
|
||||
var canvas = document.getElementById('application') as HTMLCanvasElement;
|
||||
var app = new pc.Application(canvas, { });
|
||||
const canvas = document.getElementById('application') as HTMLCanvasElement;
|
||||
const app = new pc.Application(canvas, { });
|
||||
app.start();
|
||||
|
||||
// fill the available space at full resolution
|
||||
@@ -8,24 +8,24 @@ app.setCanvasFillMode(pc.FILLMODE_FILL_WINDOW);
|
||||
app.setCanvasResolution(pc.RESOLUTION_AUTO);
|
||||
|
||||
// ensure canvas is resized when window changes size
|
||||
window.addEventListener('resize', function() {
|
||||
window.addEventListener('resize', () => {
|
||||
app.resizeCanvas();
|
||||
});
|
||||
|
||||
// create box entity
|
||||
var cube = new pc.Entity('cube');
|
||||
const cube = new pc.Entity('cube');
|
||||
cube.addComponent('model', {
|
||||
type: 'box'
|
||||
});
|
||||
|
||||
// create camera entity
|
||||
var camera = new pc.Entity('camera');
|
||||
const camera = new pc.Entity('camera');
|
||||
camera.addComponent('camera', {
|
||||
clearColor: new pc.Color(0.1, 0.1, 0.1)
|
||||
});
|
||||
|
||||
// create directional light entity
|
||||
var light = new pc.Entity('light');
|
||||
const light = new pc.Entity('light');
|
||||
light.addComponent('light');
|
||||
|
||||
// add to hierarchy
|
||||
@@ -38,6 +38,6 @@ camera.setPosition(0, 0, 3);
|
||||
light.setEulerAngles(45, 0, 0);
|
||||
|
||||
// register a global update event
|
||||
app.on('update', function (deltaTime) {
|
||||
app.on('update', deltaTime => {
|
||||
cube.rotate(10 * deltaTime, 20 * deltaTime, 30 * deltaTime);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
|
||||
+1
-1
@@ -153,7 +153,7 @@ Q.nfbind<string>(nodeStyle)('foo').done((result: string) => {
|
||||
});
|
||||
|
||||
class Repo {
|
||||
private items: any[] = [
|
||||
private readonly items: any[] = [
|
||||
{name: 'Max', cute: false},
|
||||
{name: 'Annie', cute: true}
|
||||
];
|
||||
|
||||
@@ -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 }
|
||||
];
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -154,7 +154,7 @@ namespace BoardSquare {
|
||||
export class BoardSquare extends React.Component<BoardSquareP> {
|
||||
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<BoardP> {
|
||||
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);
|
||||
|
||||
|
||||
@@ -167,7 +167,7 @@ namespace BoardSquare {
|
||||
export class BoardSquare extends React.Component<BoardSquareP> {
|
||||
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<BoardP> {
|
||||
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);
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ export class ReactHamburgerMenuTest extends React.PureComponent<{}, State> {
|
||||
return <HamburgerMenu {...props}/>;
|
||||
}
|
||||
|
||||
private menuClicked = (): void => this.setState({isOpen: !this.state.isOpen});
|
||||
private readonly menuClicked = (): void => this.setState({isOpen: !this.state.isOpen});
|
||||
}
|
||||
|
||||
interface State {
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace I18nDirect {
|
||||
|
||||
class I18nDirect extends React.Component<I18nDirect.Props> {
|
||||
|
||||
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<I18nDirect.Props> {
|
||||
}
|
||||
|
||||
|
||||
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<I18nMixin.Props> implements IntlComponent {
|
||||
|
||||
private _currentLocale: string
|
||||
private readonly _currentLocale: string
|
||||
|
||||
constructor( props: I18nMixin.Props ) {
|
||||
super( props )
|
||||
|
||||
@@ -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 = () => (
|
||||
<View>
|
||||
<Text>Drawer content</Text>
|
||||
</View>
|
||||
|
||||
@@ -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});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<NativeScrollEvent>) => {
|
||||
private readonly onScroll = (event: NativeSyntheticEvent<NativeScrollEvent>) => {
|
||||
console.log("Scrolled: ", event);
|
||||
}
|
||||
|
||||
private onLayout = (event: LayoutChangeEvent) => {
|
||||
private readonly onLayout = (event: LayoutChangeEvent) => {
|
||||
console.log("Layout: ", event);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ class StartScreen extends React.Component<NavigationScreenProps<StartScreenNavig
|
||||
</View>
|
||||
);
|
||||
}
|
||||
private navigateToNextScreen = (): void => {
|
||||
private readonly navigateToNextScreen = (): void => {
|
||||
const params: NextScreenNavigationParams = {
|
||||
id: this.props.navigation.state.params.id,
|
||||
name: this.props.navigation.state.params.s,
|
||||
|
||||
@@ -19,7 +19,7 @@ class ComponentThatUsesContext extends React.Component<Props> {
|
||||
router: PropTypes.object.isRequired
|
||||
};
|
||||
context: RouterChildContext<Params>;
|
||||
private onClick = () => {
|
||||
private readonly onClick = () => {
|
||||
const {
|
||||
history,
|
||||
route: {
|
||||
|
||||
@@ -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<string> = (option) => {
|
||||
private readonly onSelectChange: ReactSelectModule.OnChangeSingleHandler<string> = (option) => {
|
||||
const optionValue: string = option.value;
|
||||
}
|
||||
|
||||
@@ -187,7 +187,7 @@ describe("Examples", () => {
|
||||
|
||||
it("onValueClick", () => {
|
||||
class Component extends React.Component {
|
||||
private onValueClick: ReactSelectModule.OnValueClickHandler<number> = (option) => {
|
||||
private readonly onValueClick: ReactSelectModule.OnValueClickHandler<number> = (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<CustomValueType> = (option) => {
|
||||
private readonly onValueClick: ReactSelectModule.OnValueClickHandler<CustomValueType> = (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<CustomValueType> = (option) => {
|
||||
private readonly onSelectChange: ReactSelectModule.OnChangeSingleHandler<CustomValueType> = (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<string> = option => {
|
||||
private readonly onSelectChange: ReactSelectModule.OnChangeSingleHandler<string> = option => {
|
||||
const optionValue: string = option.value;
|
||||
}
|
||||
|
||||
private menuRenderer: ReactSelectModule.MenuRendererHandler = props => {
|
||||
private readonly menuRenderer: ReactSelectModule.MenuRendererHandler = props => {
|
||||
const options = props.options.map(option => {
|
||||
return <div className="option">{option.label}</div>;
|
||||
});
|
||||
@@ -265,7 +265,7 @@ describe("Examples", () => {
|
||||
|
||||
it("Menu renderer with custom value type example", () => {
|
||||
class Component extends React.Component {
|
||||
private menuRenderer: ReactSelectModule.MenuRendererHandler<CustomValueType> = props => {
|
||||
private readonly menuRenderer: ReactSelectModule.MenuRendererHandler<CustomValueType> = props => {
|
||||
const options = props.options.map(option => {
|
||||
return (
|
||||
<div className="option" data-value1={option.value.prop1}
|
||||
@@ -291,11 +291,11 @@ describe("Examples", () => {
|
||||
|
||||
it("Input render example", () => {
|
||||
class Component extends React.Component {
|
||||
private onSelectChange: ReactSelectModule.OnChangeSingleHandler<string> = option => {
|
||||
private readonly onSelectChange: ReactSelectModule.OnChangeSingleHandler<string> = option => {
|
||||
const optionValue: string = option.value;
|
||||
}
|
||||
|
||||
private inputRenderer: ReactSelectModule.InputRendererHandler = props => {
|
||||
private readonly inputRenderer: ReactSelectModule.InputRendererHandler = props => {
|
||||
return <input {...props} />;
|
||||
}
|
||||
|
||||
|
||||
@@ -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)});
|
||||
|
||||
@@ -4,26 +4,26 @@ import * as ReactSwipe from "react-swipe";
|
||||
class ReactSwipeTest extends React.PureComponent {
|
||||
private swipeComponent: ReactSwipe | null = null;
|
||||
|
||||
private onPrev: React.MouseEventHandler<HTMLButtonElement> = () => {
|
||||
private readonly onPrev: React.MouseEventHandler<HTMLButtonElement> = () => {
|
||||
if (this.swipeComponent != null) {
|
||||
this.swipeComponent.prev();
|
||||
}
|
||||
}
|
||||
|
||||
private onNext: React.MouseEventHandler<HTMLButtonElement> = () => {
|
||||
private readonly onNext: React.MouseEventHandler<HTMLButtonElement> = () => {
|
||||
if (this.swipeComponent != null) {
|
||||
this.swipeComponent.next();
|
||||
}
|
||||
}
|
||||
|
||||
private onSlideToStart: React.MouseEventHandler<HTMLButtonElement> = () => {
|
||||
private readonly onSlideToStart: React.MouseEventHandler<HTMLButtonElement> = () => {
|
||||
if (this.swipeComponent != null) {
|
||||
const lastSlide = this.swipeComponent.getNumSlides() - 1;
|
||||
this.swipeComponent.slide(lastSlide, 1000);
|
||||
}
|
||||
}
|
||||
|
||||
private onGetCurrentPosition: React.MouseEventHandler<HTMLButtonElement> = () => {
|
||||
private readonly onGetCurrentPosition: React.MouseEventHandler<HTMLButtonElement> = () => {
|
||||
const currentPosition = this.swipeComponent != null ? this.swipeComponent.getPos() : 0;
|
||||
alert(currentPosition);
|
||||
}
|
||||
|
||||
@@ -2,18 +2,18 @@ import * as React from 'react';
|
||||
import * as Swipeable from 'react-swipeable';
|
||||
|
||||
class SampleComponent extends React.PureComponent<Swipeable.SwipeableProps> {
|
||||
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 (
|
||||
|
||||
@@ -25,7 +25,7 @@ export class DraggableTest extends React.PureComponent {
|
||||
return <Draggable style={style} children={this.callback} />;
|
||||
}
|
||||
|
||||
private callback = (argument: DraggableCallbackArgument): JSX.Element => {
|
||||
private readonly callback = (argument: DraggableCallbackArgument): JSX.Element => {
|
||||
return <div />;
|
||||
}
|
||||
}
|
||||
@@ -44,19 +44,19 @@ export class SwipeableTest extends React.PureComponent {
|
||||
</Swipeable>;
|
||||
}
|
||||
|
||||
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 <CustomGesture config={this.move} onGesture={this.handler} />;
|
||||
}
|
||||
|
||||
private handler = () => {
|
||||
private readonly handler = () => {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -654,13 +654,11 @@ const STATUS_LOADING = 1
|
||||
const STATUS_LOADED = 2
|
||||
|
||||
export class InfiniteLoaderExample extends PureComponent<any, any> {
|
||||
_timeoutIdMap: any;
|
||||
_timeoutIds = new Set<number>();
|
||||
|
||||
constructor(props) {
|
||||
super(props)
|
||||
|
||||
this._timeoutIdMap = {}
|
||||
|
||||
this._clearData = this._clearData.bind(this)
|
||||
this._isRowLoaded = this._isRowLoaded.bind(this)
|
||||
this._loadMoreRows = this._loadMoreRows.bind(this)
|
||||
@@ -668,9 +666,7 @@ export class InfiniteLoaderExample extends PureComponent<any, any> {
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
Object.keys(this._timeoutIdMap).forEach(timeoutId => {
|
||||
clearTimeout(timeoutId as any)
|
||||
})
|
||||
this._timeoutIds.forEach(clearTimeout);
|
||||
}
|
||||
|
||||
render() {
|
||||
@@ -731,7 +727,7 @@ export class InfiniteLoaderExample extends PureComponent<any, any> {
|
||||
const timeoutId = setTimeout(() => {
|
||||
const { loadedRowCount, loadingRowCount } = this.state
|
||||
|
||||
delete this._timeoutIdMap[timeoutId]
|
||||
this._timeoutIds.delete(timeoutId);
|
||||
|
||||
for (let i = startIndex; i <= stopIndex; i++) {
|
||||
loadedRowsMap[i] = STATUS_LOADED
|
||||
@@ -745,7 +741,7 @@ export class InfiniteLoaderExample extends PureComponent<any, any> {
|
||||
promiseResolver()
|
||||
}, 1000 + Math.round(Math.random() * 2000))
|
||||
|
||||
this._timeoutIdMap[timeoutId] = true
|
||||
this._timeoutIds.add(timeoutId);
|
||||
|
||||
let promiseResolver
|
||||
|
||||
|
||||
@@ -85,7 +85,7 @@ class ModernComponent extends React.Component<Props, State>
|
||||
});
|
||||
}
|
||||
|
||||
private _myComponent: MyComponent;
|
||||
private readonly _myComponent: MyComponent;
|
||||
private _input: HTMLInputElement | null;
|
||||
|
||||
render() {
|
||||
|
||||
@@ -110,7 +110,7 @@ class ModernComponent extends React.Component<Props, State>
|
||||
});
|
||||
}
|
||||
|
||||
private _myComponent: MyComponent;
|
||||
private readonly _myComponent: MyComponent;
|
||||
private _input: HTMLInputElement | null;
|
||||
|
||||
render() {
|
||||
|
||||
@@ -3529,7 +3529,7 @@ render() {
|
||||
class Example115 extends React.Component<any, any> {
|
||||
// https://reactstrap.github.io/components/carousel/
|
||||
|
||||
private items = [
|
||||
private readonly items = [
|
||||
{
|
||||
src: 'data:image/svg+xml...',
|
||||
altText: 'Slide 1',
|
||||
|
||||
@@ -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}`;
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ class RouteOne extends React.Component<RouteComponentProps<{}>> {
|
||||
}
|
||||
|
||||
class RouteTwo extends React.Component<RouteComponentProps<{}>> {
|
||||
private onUpdate: OnUpdateCall = (location) => { console.log("update"); };
|
||||
private readonly onUpdate: OnUpdateCall = (location) => { console.log("update"); };
|
||||
|
||||
render() {
|
||||
return <div>
|
||||
@@ -65,11 +65,11 @@ interface Params {
|
||||
}
|
||||
|
||||
class RouteFour extends React.Component<RouteComponentProps<{}>> {
|
||||
private routes: RouteConfiguration[] = [
|
||||
private readonly routes: RouteConfiguration[] = [
|
||||
{ path: "/four/something/:page", component: RouteTwo }
|
||||
];
|
||||
|
||||
private getKey: GetKeyFunction<Params> = (match, route, location) => {
|
||||
private readonly getKey: GetKeyFunction<Params> = (match, route, location) => {
|
||||
return "my-key-" + match.url;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ function testFunction() {
|
||||
}
|
||||
|
||||
class TestClass {
|
||||
private dummy: string;
|
||||
private readonly dummy: string;
|
||||
}
|
||||
|
||||
const testObj = {
|
||||
|
||||
@@ -354,7 +354,7 @@ interface CreepMemory {
|
||||
const interShardData = JSON.parse(RawMemory.interShardSegment);
|
||||
if (interShardData.creeps[creep.name]) {
|
||||
creep.memory = interShardData[creep.name];
|
||||
delete interShardData.creeps[creep.name];
|
||||
delete interShardData.creeps[creep.name]; // tslint:disable-line no-dynamic-delete
|
||||
}
|
||||
RawMemory.interShardSegment = JSON.stringify(interShardData);
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
Vendored
+2
@@ -87,7 +87,9 @@ declare namespace Sinon {
|
||||
invokeCallback(...args: any[]): void;
|
||||
getCall(n: number): SinonSpyCall;
|
||||
getCalls(): SinonSpyCall[];
|
||||
/// @deprecated Use resetHistory() instead
|
||||
reset(): void;
|
||||
resetHistory(): void;
|
||||
printf(format: string, ...args: any[]): string;
|
||||
restore(): void;
|
||||
}
|
||||
|
||||
@@ -157,6 +157,7 @@ function testSymbolMatch() {
|
||||
|
||||
function testResetHistory() {
|
||||
sinon.stub().resetHistory();
|
||||
sinon.spy().resetHistory();
|
||||
}
|
||||
|
||||
function testUsingPromises() {
|
||||
|
||||
@@ -47,8 +47,8 @@ function setFilters_0() {
|
||||
}
|
||||
|
||||
function setFilters_1(oldPOS: RegExp) {
|
||||
Sizzle.selectors.match['POS'] = new RegExp(oldPOS.source.replace('first', 'uno'), 'gi');
|
||||
Sizzle.selectors.setFilters['uno'] = Sizzle.selectors.setFilters['first'];
|
||||
delete Sizzle.selectors.setFilters['first'];
|
||||
Sizzle.selectors.match.POS = new RegExp(oldPOS.source.replace('first', 'uno'), 'gi');
|
||||
Sizzle.selectors.setFilters.uno = Sizzle.selectors.setFilters.first;
|
||||
delete Sizzle.selectors.setFilters.first;
|
||||
Sizzle('div:uno'); // ==> [ <div> ]
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ $('.newSelection');
|
||||
grid.setSelectedRows([0, 1, 2]);
|
||||
|
||||
class SingleCellSelectionModel extends Slick.SelectionModel<MyData, Slick.Range[]> {
|
||||
private self: SingleCellSelectionModel = null;
|
||||
private readonly self: SingleCellSelectionModel = null;
|
||||
private _grid: Slick.Grid<MyData>;
|
||||
|
||||
constructor() {
|
||||
|
||||
@@ -388,7 +388,7 @@ new ssh2.Server({
|
||||
var session = accept();
|
||||
session.on('sftp', (accept: any, reject: any) => {
|
||||
console.log('Client SFTP session');
|
||||
var openFiles: any = {};
|
||||
var openFiles = new Set<number>();
|
||||
var handleCount = 0;
|
||||
// `sftpStream` is an `SFTPStream` instance in server mode
|
||||
// see: https://github.com/mscdex/ssh2-streams/blob/master/SFTPStream.md
|
||||
@@ -401,12 +401,12 @@ new ssh2.Server({
|
||||
// be a real file descriptor number for example if actually opening
|
||||
// the file on the disk
|
||||
var handle = new Buffer(4);
|
||||
openFiles[handleCount] = true;
|
||||
openFiles.add(handleCount);
|
||||
handle.writeUInt32BE(handleCount++, 0, true);
|
||||
sftpStream.handle(reqid, handle);
|
||||
console.log('Opening file for write')
|
||||
}).on('WRITE', (reqid: any, handle: any, offset: any, data: any) => {
|
||||
if (handle.length !== 4 || !openFiles[handle.readUInt32BE(0, true)])
|
||||
if (handle.length !== 4 || !openFiles.has(handle.readUInt32BE(0, true)))
|
||||
return sftpStream.status(reqid, STATUS_CODE.FAILURE);
|
||||
// fake the write
|
||||
sftpStream.status(reqid, STATUS_CODE.OK);
|
||||
@@ -414,9 +414,9 @@ new ssh2.Server({
|
||||
console.log('Write to file at offset %d: %s', offset, inspected);
|
||||
}).on('CLOSE', (reqid: any, handle: any) => {
|
||||
var fnum: any;
|
||||
if (handle.length !== 4 || !openFiles[(fnum = handle.readUInt32BE(0, true))])
|
||||
if (handle.length !== 4 || !openFiles.has((fnum = handle.readUInt32BE(0, true))))
|
||||
return sftpStream.status(reqid, STATUS_CODE.FAILURE);
|
||||
delete openFiles[fnum];
|
||||
openFiles.delete(fnum);
|
||||
sftpStream.status(reqid, STATUS_CODE.OK);
|
||||
console.log('Closing file');
|
||||
});
|
||||
|
||||
@@ -109,7 +109,7 @@ function test_swipey() {
|
||||
var canvas = <HTMLCanvasElement>$('canvas')[0];
|
||||
var context = canvas.getContext('2d');
|
||||
var iOS = (/iphone|ipad/i).test(navigator.userAgent);
|
||||
var pointers = {};
|
||||
var pointers = new Map<string, any>();
|
||||
// handle resizing / rotating of the viewport
|
||||
var width, height;
|
||||
$(window).bind(viewporter.ACTIVE ? 'viewportchange' : 'resize', function () {
|
||||
@@ -123,11 +123,12 @@ function test_swipey() {
|
||||
for (var i = 0; i < touches.length; i++) {
|
||||
identifier = touches[i].identifier || 'mouse';
|
||||
// if no pointer has been created for this finger yet, do it
|
||||
if (!pointers[identifier]) {
|
||||
pointers[identifier] = new drawingPointer(context, rainbow(8, Object.keys(pointers).length));
|
||||
let pointer = pointers.get(identifier);
|
||||
if (!pointer) {
|
||||
pointers.set(identifier, pointer = new drawingPointer(context, rainbow(8, Object.keys(pointers).length)));
|
||||
}
|
||||
pointers[identifier].start();
|
||||
pointers[identifier].addPoint(touches[i].pageX, touches[i].pageY);
|
||||
pointer.start();
|
||||
pointer.addPoint(touches[i].pageX, touches[i].pageY);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -136,8 +137,9 @@ function test_swipey() {
|
||||
var identifier;
|
||||
for (var i = 0; i < touches.length; i++) {
|
||||
identifier = touches[i].identifier || 'mouse';
|
||||
if (pointers[identifier] && pointers[identifier].painting) {
|
||||
pointers[identifier].addPoint(touches[i].pageX, touches[i].pageY, true);
|
||||
const pointer = pointers.get(identifier);
|
||||
if (pointer && pointer.painting) {
|
||||
pointer.addPoint(touches[i].pageX, touches[i].pageY, true);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -147,11 +149,12 @@ function test_swipey() {
|
||||
var identifier;
|
||||
for (var i = 0; i < touches.length; i++) {
|
||||
identifier = touches[i].identifier || 'mouse';
|
||||
if (pointers[identifier]) {
|
||||
pointers[identifier].stop();
|
||||
const pointer = pointers.get(identifier);
|
||||
if (pointer) {
|
||||
pointer.stop();
|
||||
(function (identifier) {
|
||||
setTimeout(function () {
|
||||
delete pointers[identifier];
|
||||
pointers.delete(identifier);
|
||||
}, 300);
|
||||
})(identifier);
|
||||
}
|
||||
@@ -161,10 +164,10 @@ function test_swipey() {
|
||||
window.setInterval(function () {
|
||||
context.clearRect(0, 0, width, height);
|
||||
var counter = 0, ratio = (<any>window).devicePixelRatio || 1;
|
||||
for (var identifier in pointers) {
|
||||
pointers[identifier].redraw();
|
||||
pointers.forEach(pointer => {
|
||||
pointer.redraw();
|
||||
counter++;
|
||||
}
|
||||
});
|
||||
context.font = (10 * ratio) + 'pt Arial';
|
||||
context.fillText(counter + ' active pointers', 15 * ratio, 25 * ratio);
|
||||
|
||||
|
||||
@@ -37,5 +37,5 @@ export class WallabyConfig implements wallabyjs.IWallabyConfig {
|
||||
}
|
||||
};
|
||||
|
||||
constructor(private wallaby: wallabyjs.IWallaby) { }
|
||||
constructor(private readonly wallaby: wallabyjs.IWallaby) { }
|
||||
}
|
||||
|
||||
+3
-3
@@ -407,7 +407,7 @@ interface PublicKeyCredentialParameters {
|
||||
interface PublicKeyCredentialDescriptor {
|
||||
type: 'public-key';
|
||||
id: BufferSource;
|
||||
transports?: Array<string>;
|
||||
transports?: string[];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -427,10 +427,10 @@ interface MakePublicKeyCredentialOptions {
|
||||
user: PublicKeyCredentialUserEntity;
|
||||
|
||||
challenge: BufferSource;
|
||||
pubKeyCredParams: Array<PublicKeyCredentialParameters>;
|
||||
pubKeyCredParams: PublicKeyCredentialParameters[];
|
||||
|
||||
timeout?: number;
|
||||
excludeCredentials?: Array<PublicKeyCredentialDescriptor>;
|
||||
excludeCredentials?: PublicKeyCredentialDescriptor[];
|
||||
authenticatorSelection?: AuthenticatorSelectionCriteria;
|
||||
attestation?: 'none' | 'indirect' | 'direct';
|
||||
extensions?: any;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -7,7 +7,7 @@ import dns = require('dns');
|
||||
import when = require("when");
|
||||
|
||||
class ForeignPromise<T> {
|
||||
constructor(private value: T) {
|
||||
constructor(private readonly value: T) {
|
||||
}
|
||||
|
||||
then<U>(onFulfilled: (value: T) => U, onRejected?: (reason: any) => U) { return new ForeignPromise<U>(onFulfilled(this.value)); }
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user