mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-24 05:06:02 +08:00
Lint test files too (#14791)
This commit is contained in:
@@ -19,19 +19,19 @@ class AuthService {
|
||||
* Required by HTTP interceptor.
|
||||
* Function is attached to provider to be invisible for regular users of this service.
|
||||
*/
|
||||
pushToBuffer = function(config: ng.IRequestConfig, deferred: ng.IDeferred<any>) {
|
||||
pushToBuffer = (config: ng.IRequestConfig, deferred: ng.IDeferred<any>) => {
|
||||
this.buffer.push({
|
||||
config,
|
||||
deferred
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
$get = [
|
||||
'$rootScope', '$injector', function($rootScope: ng.IScope, $injector: ng.auto.IInjectorService) {
|
||||
let $http: ng.IHttpService; //initialized later because of circular dependency problem
|
||||
'$rootScope', '$injector', ($rootScope: ng.IScope, $injector: ng.auto.IInjectorService) => {
|
||||
let $http: ng.IHttpService; // initialized later because of circular dependency problem
|
||||
function retry(config: ng.IRequestConfig, deferred: ng.IDeferred<any>) {
|
||||
$http = $http || $injector.get<ng.IHttpService>('$http');
|
||||
$http(config).then(function(response) {
|
||||
$http(config).then(response => {
|
||||
deferred.resolve(response);
|
||||
});
|
||||
}
|
||||
@@ -49,7 +49,7 @@ class AuthService {
|
||||
retryAll();
|
||||
}
|
||||
};
|
||||
} as any
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
@@ -61,13 +61,13 @@ angular.module('http-auth-interceptor', [])
|
||||
* $http interceptor.
|
||||
* On 401 response - it stores the request and broadcasts 'event:angular-auth-loginRequired'.
|
||||
*/
|
||||
.config(['$httpProvider', 'authServiceProvider', function($httpProvider: ng.IHttpProvider, authServiceProvider: any) {
|
||||
.config(['$httpProvider', 'authServiceProvider', ($httpProvider: ng.IHttpProvider, authServiceProvider: any) => {
|
||||
|
||||
$httpProvider.defaults.headers.common = {Authorization: 'Bearer token'};
|
||||
$httpProvider.defaults.headers.get['Authorization'] = 'Bearer token';
|
||||
$httpProvider.defaults.headers.post['Authorization'] = function(config: ng.IRequestConfig): string { return 'Bearer token'; };
|
||||
$httpProvider.defaults.headers.post['Authorization'] = (config: ng.IRequestConfig) => 'Bearer token';
|
||||
|
||||
const interceptor = ['$rootScope', '$q', function($rootScope: ng.IScope, $q: ng.IQService) {
|
||||
const interceptor = ['$rootScope', '$q', ($rootScope: ng.IScope, $q: ng.IQService) => {
|
||||
function success(response: ng.IHttpPromiseCallbackArg<any>) {
|
||||
return response;
|
||||
}
|
||||
@@ -83,13 +83,10 @@ angular.module('http-auth-interceptor', [])
|
||||
return $q.reject(response);
|
||||
}
|
||||
|
||||
return function(promise: ng.IHttpPromise<any>) {
|
||||
return promise.then(success, error);
|
||||
};
|
||||
|
||||
} as any];
|
||||
return (promise: ng.IHttpPromise<any>) => promise.then(success, error);
|
||||
}];
|
||||
$httpProvider.interceptors.push(interceptor);
|
||||
} as any]);
|
||||
}]);
|
||||
|
||||
namespace HttpAndRegularPromiseTests {
|
||||
interface Person {
|
||||
@@ -161,8 +158,8 @@ namespace My.Namespace {
|
||||
|
||||
// IModule Registering Test
|
||||
let mod = angular.module('tests', []);
|
||||
mod.controller('name', function($scope: ng.IScope) { });
|
||||
mod.controller('name', ['$scope', function($scope: ng.IScope) { }]);
|
||||
mod.controller('name', ($scope: ng.IScope) => { });
|
||||
mod.controller('name', ['$scope', ($scope: ng.IScope) => { }]);
|
||||
mod.controller('name', class {
|
||||
// Uncommenting the next line should lead to a type error because this signature isn't compatible
|
||||
// with the signature of the `$onChanges` hook:
|
||||
@@ -170,8 +167,8 @@ mod.controller('name', class {
|
||||
});
|
||||
mod.controller({
|
||||
MyCtrl: class{},
|
||||
MyCtrl2: function() {}, // tslint:disable-line:object-literal-shorthand
|
||||
MyCtrl3: ['$fooService', function($fooService: any) { }]
|
||||
MyCtrl2() {},
|
||||
MyCtrl3: ['$fooService', ($fooService: any) => { }]
|
||||
});
|
||||
mod.directive('myDirectiveA', ($rootScope: ng.IRootScopeService) => {
|
||||
return (scope, el, attrs) => {
|
||||
@@ -183,7 +180,7 @@ mod.directive('myDirectiveA', ($rootScope: ng.IRootScopeService) => {
|
||||
scope.$watch(() => foo, () => el.text(foo));
|
||||
};
|
||||
});
|
||||
mod.directive('myDirectiveB', ['$rootScope', function($rootScope: ng.IRootScopeService) {
|
||||
mod.directive('myDirectiveB', ['$rootScope', ($rootScope: ng.IRootScopeService) => {
|
||||
return {
|
||||
link(scope, el, attrs) {
|
||||
el.click(e => {
|
||||
@@ -200,28 +197,28 @@ mod.directive({
|
||||
template: 'my-bar-dir.tpl.html'
|
||||
})]
|
||||
});
|
||||
mod.factory('name', function($scope: ng.IScope) { });
|
||||
mod.factory('name', ['$scope', function($scope: ng.IScope) { }]);
|
||||
mod.factory('name', ($scope: ng.IScope) => {});
|
||||
mod.factory('name', ['$scope', ($scope: ng.IScope) => {}]);
|
||||
mod.factory({
|
||||
name1: function(foo: any) { }, // tslint:disable-line:object-literal-shorthand
|
||||
name2: ['foo', function(foo: any) { }]
|
||||
name1(foo: any) {},
|
||||
name2: ['foo', (foo: any) => {}]
|
||||
});
|
||||
mod.filter('name', function($scope: ng.IScope) { });
|
||||
mod.filter('name', ['$scope', function($scope: ng.IScope) { }]);
|
||||
mod.filter('name', ($scope: ng.IScope) => {});
|
||||
mod.filter('name', ['$scope', ($scope: ng.IScope) => {}]);
|
||||
mod.filter({
|
||||
name1: function(foo: any) { }, // tslint:disable-line:object-literal-shorthand
|
||||
name2: ['foo', function(foo: any) { }]
|
||||
name1(foo: any) {},
|
||||
name2: ['foo', (foo: any) => {}]
|
||||
});
|
||||
mod.provider('name', function($scope: ng.IScope) { return { $get: () => { } }; });
|
||||
mod.provider('name', ($scope: ng.IScope) => ({ $get: () => { } }));
|
||||
mod.provider('name', TestProvider);
|
||||
mod.provider('name', ['$scope', function($scope: ng.IScope) { } as any]);
|
||||
mod.provider('name', ['$scope', ($scope: ng.IScope) => {}]);
|
||||
mod.provider(My.Namespace);
|
||||
mod.service('name', function($scope: ng.IScope) { });
|
||||
mod.service('name', ['$scope', function($scope: ng.IScope) { } as any]);
|
||||
mod.service('name', ($scope: ng.IScope) => {});
|
||||
mod.service('name', ['$scope', ($scope: ng.IScope) => {}]);
|
||||
mod.service({
|
||||
MyCtrl: class{},
|
||||
MyCtrl2: function() {}, // tslint:disable-line:object-literal-shorthand
|
||||
MyCtrl3: ['$fooService', function($fooService: any) { }]
|
||||
MyCtrl2: () => {}, // tslint:disable-line:object-literal-shorthand
|
||||
MyCtrl3: ['$fooService', ($fooService: any) => {}]
|
||||
});
|
||||
mod.constant('name', 23);
|
||||
mod.constant('name', '23');
|
||||
@@ -229,8 +226,8 @@ mod.constant(My.Namespace);
|
||||
mod.value('name', 23);
|
||||
mod.value('name', '23');
|
||||
mod.value(My.Namespace);
|
||||
mod.decorator('name', function($scope: ng.IScope) {});
|
||||
mod.decorator('name', ['$scope', function($scope: ng.IScope) {} as any]);
|
||||
mod.decorator('name', ($scope: ng.IScope) => {});
|
||||
mod.decorator('name', ['$scope', ($scope: ng.IScope) => {}]);
|
||||
|
||||
class TestProvider implements ng.IServiceProvider {
|
||||
constructor(private $scope: ng.IScope) {
|
||||
@@ -242,7 +239,7 @@ class TestProvider implements ng.IServiceProvider {
|
||||
|
||||
// QProvider tests
|
||||
angular.module('qprovider-test', [])
|
||||
.config(['$qProvider', function($qProvider: ng.IQProvider) {
|
||||
.config(['$qProvider', ($qProvider: ng.IQProvider) => {
|
||||
const provider: ng.IQProvider = $qProvider.errorOnUnhandledRejections(false);
|
||||
const currentValue: boolean = $qProvider.errorOnUnhandledRejections();
|
||||
}]);
|
||||
@@ -278,7 +275,7 @@ foo.then((x) => {
|
||||
}).then((x) => {
|
||||
// Object is inferred here
|
||||
x.a = 123;
|
||||
//Try a promise
|
||||
// Try a promise
|
||||
var y: ng.IPromise<number>;
|
||||
var condition: boolean;
|
||||
return condition ? y : x.a; // IPromise<T> | T, both are good for the 1st arg of .then()
|
||||
@@ -537,7 +534,6 @@ namespace TestPromise {
|
||||
(reason) => anyOf3(reject, tresult, tresultPromise)
|
||||
));
|
||||
|
||||
|
||||
assertPromiseType<ng.IHttpPromiseCallbackArg<TResult>>(promise.then((result) => tresultHttpPromise));
|
||||
|
||||
assertPromiseType<TResult | TOther>(promise.then((result) => result, (any) => tother));
|
||||
@@ -591,10 +587,10 @@ namespace TestPromise {
|
||||
function test_angular_forEach() {
|
||||
const values: { [key: string]: string } = { name: 'misko', gender: 'male' };
|
||||
const log: string[] = [];
|
||||
angular.forEach(values, function(value, key) {
|
||||
angular.forEach(values, (value, key) => {
|
||||
this.push(key + ': ' + value);
|
||||
}, log);
|
||||
//expect(log).toEqual(['name: misko', 'gender: male']);
|
||||
// expect(log).toEqual(['name: misko', 'gender: male']);
|
||||
}
|
||||
|
||||
// angular.element() tests
|
||||
@@ -709,19 +705,12 @@ angular.module('AnotherSampleDirective', []).directive('myDirective', ['$interpo
|
||||
const defer = $q.defer();
|
||||
defer.reject();
|
||||
defer.resolve();
|
||||
defer.promise.then(function(d) {
|
||||
return d;
|
||||
}).then(function(): any {
|
||||
return null;
|
||||
}, function(): any {
|
||||
return null;
|
||||
})
|
||||
.catch((): any => {
|
||||
return null;
|
||||
})
|
||||
.finally((): any => {
|
||||
return null;
|
||||
});
|
||||
defer.promise.then(d => d)
|
||||
.then(
|
||||
(): any => null,
|
||||
(): any => null)
|
||||
.catch((): any => null)
|
||||
.finally((): any => null);
|
||||
let promise = new $q((resolve) => {
|
||||
resolve();
|
||||
});
|
||||
@@ -741,39 +730,39 @@ angular.module('AnotherSampleDirective', []).directive('myDirective', ['$interpo
|
||||
|
||||
// test from https://docs.angularjs.org/guide/directive
|
||||
angular.module('docsSimpleDirective', [])
|
||||
.controller('Controller', ['$scope', function($scope: any) {
|
||||
.controller('Controller', ['$scope', ($scope: any) => {
|
||||
$scope.customer = {
|
||||
name: 'Naomi',
|
||||
address: '1600 Amphitheatre'
|
||||
};
|
||||
}])
|
||||
.directive('myCustomer', function() {
|
||||
.directive('myCustomer', () => {
|
||||
return {
|
||||
template: 'Name: {{customer.name}} Address: {{customer.address}}'
|
||||
};
|
||||
});
|
||||
|
||||
angular.module('docsTemplateUrlDirective', [])
|
||||
.controller('Controller', ['$scope', function($scope: any) {
|
||||
.controller('Controller', ['$scope', ($scope: any) => {
|
||||
$scope.customer = {
|
||||
name: 'Naomi',
|
||||
address: '1600 Amphitheatre'
|
||||
};
|
||||
}])
|
||||
.directive('myCustomer', function() {
|
||||
.directive('myCustomer', () => {
|
||||
return {
|
||||
templateUrl: 'my-customer.html'
|
||||
};
|
||||
});
|
||||
|
||||
angular.module('docsRestrictDirective', [])
|
||||
.controller('Controller', ['$scope', function($scope: any) {
|
||||
.controller('Controller', ['$scope', ($scope: any) => {
|
||||
$scope.customer = {
|
||||
name: 'Naomi',
|
||||
address: '1600 Amphitheatre'
|
||||
};
|
||||
}])
|
||||
.directive('myCustomer', function() {
|
||||
.directive('myCustomer', () => {
|
||||
return {
|
||||
restrict: 'E',
|
||||
templateUrl: 'my-customer.html'
|
||||
@@ -781,19 +770,19 @@ angular.module('docsRestrictDirective', [])
|
||||
});
|
||||
|
||||
angular.module('docsScopeProblemExample', [])
|
||||
.controller('NaomiController', ['$scope', function($scope: any) {
|
||||
.controller('NaomiController', ['$scope', ($scope: any) => {
|
||||
$scope.customer = {
|
||||
name: 'Naomi',
|
||||
address: '1600 Amphitheatre'
|
||||
};
|
||||
}])
|
||||
.controller('IgorController', ['$scope', function($scope: any) {
|
||||
.controller('IgorController', ['$scope', ($scope: any) => {
|
||||
$scope.customer = {
|
||||
name: 'Igor',
|
||||
address: '123 Somewhere'
|
||||
};
|
||||
}])
|
||||
.directive('myCustomer', function() {
|
||||
.directive('myCustomer', () => {
|
||||
return {
|
||||
restrict: 'E',
|
||||
templateUrl: 'my-customer.html'
|
||||
@@ -801,11 +790,11 @@ angular.module('docsScopeProblemExample', [])
|
||||
});
|
||||
|
||||
angular.module('docsIsolateScopeDirective', [])
|
||||
.controller('Controller', ['$scope', function($scope: any) {
|
||||
.controller('Controller', ['$scope', ($scope: any) => {
|
||||
$scope.naomi = { name: 'Naomi', address: '1600 Amphitheatre' };
|
||||
$scope.igor = { name: 'Igor', address: '123 Somewhere' };
|
||||
}])
|
||||
.directive('myCustomer', function() {
|
||||
.directive('myCustomer', () => {
|
||||
return {
|
||||
restrict: 'E',
|
||||
scope: {
|
||||
@@ -816,11 +805,11 @@ angular.module('docsIsolateScopeDirective', [])
|
||||
});
|
||||
|
||||
angular.module('docsIsolationExample', [])
|
||||
.controller('Controller', ['$scope', function($scope: any) {
|
||||
.controller('Controller', ['$scope', ($scope: any) => {
|
||||
$scope.naomi = { name: 'Naomi', address: '1600 Amphitheatre' };
|
||||
$scope.vojta = { name: 'Vojta', address: '3456 Somewhere Else' };
|
||||
}])
|
||||
.directive('myCustomer', function() {
|
||||
.directive('myCustomer', () => {
|
||||
return {
|
||||
restrict: 'E',
|
||||
scope: {
|
||||
@@ -831,10 +820,10 @@ angular.module('docsIsolationExample', [])
|
||||
});
|
||||
|
||||
angular.module('docsTimeDirective', [])
|
||||
.controller('Controller', ['$scope', function($scope: any) {
|
||||
.controller('Controller', ['$scope', ($scope: any) => {
|
||||
$scope.format = 'M/d/yy h:mm:ss a';
|
||||
}])
|
||||
.directive('myCurrentTime', ['$interval', 'dateFilter', function($interval: any, dateFilter: any) {
|
||||
.directive('myCurrentTime', ['$interval', 'dateFilter', ($interval: any, dateFilter: any) => {
|
||||
|
||||
return {
|
||||
link(scope: ng.IScope, element: ng.IAugmentedJQuery, attrs: ng.IAttributes) {
|
||||
@@ -845,17 +834,17 @@ angular.module('docsTimeDirective', [])
|
||||
element.text(dateFilter(new Date(), format));
|
||||
}
|
||||
|
||||
scope.$watch(attrs['myCurrentTime'], function(value: any) {
|
||||
scope.$watch(attrs['myCurrentTime'], (value: any) => {
|
||||
format = value;
|
||||
updateTime();
|
||||
});
|
||||
|
||||
element.on('$destroy', function() {
|
||||
element.on('$destroy', () => {
|
||||
$interval.cancel(timeoutId);
|
||||
});
|
||||
|
||||
// start the UI update process; save the timeoutId for canceling
|
||||
timeoutId = $interval(function() {
|
||||
timeoutId = $interval(() => {
|
||||
updateTime(); // update DOM
|
||||
}, 1000);
|
||||
}
|
||||
@@ -863,10 +852,10 @@ angular.module('docsTimeDirective', [])
|
||||
}]);
|
||||
|
||||
angular.module('docsTransclusionDirective', [])
|
||||
.controller('Controller', ['$scope', function($scope: any) {
|
||||
.controller('Controller', ['$scope', ($scope: any) => {
|
||||
$scope.name = 'Tobias';
|
||||
}])
|
||||
.directive('myDialog', function() {
|
||||
.directive('myDialog', () => {
|
||||
return {
|
||||
restrict: 'E',
|
||||
transclude: true,
|
||||
@@ -875,10 +864,10 @@ angular.module('docsTransclusionDirective', [])
|
||||
});
|
||||
|
||||
angular.module('docsTransclusionExample', [])
|
||||
.controller('Controller', ['$scope', function($scope: any) {
|
||||
.controller('Controller', ['$scope', ($scope: any) => {
|
||||
$scope.name = 'Tobias';
|
||||
}])
|
||||
.directive('myDialog', function() {
|
||||
.directive('myDialog', () => {
|
||||
return {
|
||||
restrict: 'E',
|
||||
transclude: true,
|
||||
@@ -891,16 +880,16 @@ angular.module('docsTransclusionExample', [])
|
||||
});
|
||||
|
||||
angular.module('docsIsoFnBindExample', [])
|
||||
.controller('Controller', ['$scope', '$timeout', function($scope: any, $timeout: any) {
|
||||
.controller('Controller', ['$scope', '$timeout', ($scope: any, $timeout: any) => {
|
||||
$scope.name = 'Tobias';
|
||||
$scope.hideDialog = function() {
|
||||
$scope.hideDialog = () => {
|
||||
$scope.dialogIsHidden = true;
|
||||
$timeout(function() {
|
||||
$timeout(() => {
|
||||
$scope.dialogIsHidden = false;
|
||||
}, 2000);
|
||||
};
|
||||
}])
|
||||
.directive('myDialog', function() {
|
||||
.directive('myDialog', () => {
|
||||
return {
|
||||
restrict: 'E',
|
||||
transclude: true,
|
||||
@@ -912,8 +901,8 @@ angular.module('docsIsoFnBindExample', [])
|
||||
});
|
||||
|
||||
angular.module('dragModule', [])
|
||||
.directive('myDraggable', ['$document', function($document: any) {
|
||||
return function(scope: any, element: any, attr: any) {
|
||||
.directive('myDraggable', ['$document', ($document: any) => {
|
||||
return (scope: any, element: any, attr: any) => {
|
||||
let startX = 0, startY = 0, x = 0, y = 0;
|
||||
|
||||
element.css({
|
||||
@@ -923,7 +912,7 @@ angular.module('dragModule', [])
|
||||
cursor: 'pointer'
|
||||
});
|
||||
|
||||
element.on('mousedown', function(event: any) {
|
||||
element.on('mousedown', (event: any) => {
|
||||
// Prevent default dragging of selected content
|
||||
event.preventDefault();
|
||||
startX = event.pageX - x;
|
||||
@@ -949,7 +938,7 @@ angular.module('dragModule', [])
|
||||
}]);
|
||||
|
||||
angular.module('docsTabsExample', [])
|
||||
.directive('myTabs', function() {
|
||||
.directive('myTabs', () => {
|
||||
return {
|
||||
restrict: 'E',
|
||||
transclude: true,
|
||||
@@ -957,14 +946,14 @@ angular.module('docsTabsExample', [])
|
||||
controller($scope: ng.IScope) {
|
||||
const panes: any = $scope['panes'] = [];
|
||||
|
||||
$scope['select'] = function(pane: any) {
|
||||
angular.forEach(panes, function(pane: any) {
|
||||
$scope['select'] = (pane: any) => {
|
||||
angular.forEach(panes, (pane: any) => {
|
||||
pane.selected = false;
|
||||
});
|
||||
pane.selected = true;
|
||||
};
|
||||
|
||||
this.addPane = function(pane: any) {
|
||||
this.addPane = (pane: any) => {
|
||||
if (panes.length === 0) {
|
||||
$scope['select'](pane);
|
||||
}
|
||||
@@ -974,7 +963,7 @@ angular.module('docsTabsExample', [])
|
||||
templateUrl: 'my-tabs.html'
|
||||
};
|
||||
})
|
||||
.directive('myPane', function() {
|
||||
.directive('myPane', () => {
|
||||
return {
|
||||
require: '^myTabs',
|
||||
restrict: 'E',
|
||||
@@ -990,7 +979,7 @@ angular.module('docsTabsExample', [])
|
||||
});
|
||||
|
||||
angular.module('multiSlotTranscludeExample', [])
|
||||
.directive('dropDownMenu', function() {
|
||||
.directive('dropDownMenu', () => {
|
||||
return {
|
||||
transclude: {
|
||||
button: 'button',
|
||||
@@ -1048,15 +1037,15 @@ interface ICopyExampleScope {
|
||||
}
|
||||
|
||||
angular.module('copyExample', [])
|
||||
.controller('ExampleController', ['$scope', function($scope: ICopyExampleScope) {
|
||||
.controller('ExampleController', ['$scope', ($scope: ICopyExampleScope) => {
|
||||
$scope.master = { };
|
||||
|
||||
$scope.update = function(user) {
|
||||
$scope.update = user => {
|
||||
// Example with 1 argument
|
||||
$scope.master = angular.copy(user);
|
||||
};
|
||||
|
||||
$scope.reset = function() {
|
||||
$scope.reset = () => {
|
||||
// Example with 2 arguments
|
||||
angular.copy($scope.master, $scope.user);
|
||||
};
|
||||
@@ -1129,7 +1118,7 @@ function NgModelControllerTyping() {
|
||||
var $q: angular.IQService;
|
||||
|
||||
// See https://docs.angularjs.org/api/ng/type/ngModel.NgModelController#$validators
|
||||
ngModel.$validators['validCharacters'] = function(modelValue, viewValue) {
|
||||
ngModel.$validators['validCharacters'] = (modelValue, viewValue) => {
|
||||
const value = modelValue || viewValue;
|
||||
return /[0-9]+/.test(value) &&
|
||||
/[a-z]+/.test(value) &&
|
||||
@@ -1137,7 +1126,7 @@ function NgModelControllerTyping() {
|
||||
/\W+/.test(value);
|
||||
};
|
||||
|
||||
ngModel.$asyncValidators['uniqueUsername'] = function(modelValue, viewValue) {
|
||||
ngModel.$asyncValidators['uniqueUsername'] = (modelValue, viewValue) => {
|
||||
const value = modelValue || viewValue;
|
||||
return $http.get('/api/users/' + value).
|
||||
then(function resolved() {
|
||||
@@ -1251,8 +1240,8 @@ function parseWithParams() {
|
||||
|
||||
function doBootstrap(element: Element | JQuery, mode: string): ng.auto.IInjectorService {
|
||||
if (mode === 'debug') {
|
||||
return angular.bootstrap(element, ['main', function($provide: ng.auto.IProvideService) {
|
||||
$provide.decorator('$rootScope', function($delegate: ng.IRootScopeService) {
|
||||
return angular.bootstrap(element, ['main', ($provide: ng.auto.IProvideService) => {
|
||||
$provide.decorator('$rootScope', ($delegate: ng.IRootScopeService) => {
|
||||
$delegate['debug'] = true;
|
||||
});
|
||||
}, 'debug-helpers'], {
|
||||
@@ -1272,12 +1261,12 @@ function testIHttpParamSerializerJQLikeProvider() {
|
||||
}
|
||||
|
||||
function anyOf2<T1, T2>(v1: T1, v2: T2) {
|
||||
return Math.random() < 1/2 ? v1 : v2;
|
||||
return Math.random() < 0.5 ? v1 : v2;
|
||||
}
|
||||
|
||||
function anyOf3<T1, T2, T3>(v1: T1, v2: T2, v3: T3) {
|
||||
const rnd = Math.random();
|
||||
return rnd < 1/3 ? v1 : rnd < 2/3 ? v2 : v3;
|
||||
return rnd < 0.33 ? v1 : rnd < 0.66 ? v2 : v3;
|
||||
}
|
||||
|
||||
function toPromise<T>(val: T): ng.IPromise<T> {
|
||||
|
||||
8
angular/index.d.ts
vendored
8
angular/index.d.ts
vendored
@@ -411,8 +411,8 @@ declare namespace angular {
|
||||
$invalid: boolean;
|
||||
}
|
||||
|
||||
//Allows tuning how model updates are done.
|
||||
//https://docs.angularjs.org/api/ng/directive/ngModelOptions
|
||||
// Allows tuning how model updates are done.
|
||||
// https://docs.angularjs.org/api/ng/directive/ngModelOptions
|
||||
interface INgModelOptions {
|
||||
updateOn?: string;
|
||||
debounce?: any;
|
||||
@@ -1192,7 +1192,7 @@ declare namespace angular {
|
||||
*/
|
||||
size: number;
|
||||
|
||||
//...: any additional properties from the options object when creating the cache.
|
||||
// ...: any additional properties from the options object when creating the cache.
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -2035,7 +2035,7 @@ declare namespace angular {
|
||||
declare global {
|
||||
interface JQuery {
|
||||
// TODO: events, how to define?
|
||||
//$destroy
|
||||
// $destroy
|
||||
|
||||
find(element: any): JQuery;
|
||||
find(obj: JQuery): JQuery;
|
||||
|
||||
@@ -1,20 +1,33 @@
|
||||
{
|
||||
"extends": "../tslint.json",
|
||||
"rules": {
|
||||
"class-name": true,
|
||||
"curly": true,
|
||||
"no-consecutive-blank-lines": true,
|
||||
"no-shadowed-variable": true,
|
||||
"quotemark": [true, "single"],
|
||||
"align": true,
|
||||
"callable-types": false,
|
||||
"forbidden-types": false,
|
||||
"indent": [true, "spaces"],
|
||||
"interface-name": false,
|
||||
"linebreak-style": [true, "LF"],
|
||||
"no-empty-interface": false,
|
||||
"unified-signatures": false,
|
||||
"variable-name": [true, "check-format"],
|
||||
"void-return": false
|
||||
}
|
||||
"extends": "../tslint.json",
|
||||
"rules": {
|
||||
"class-name": true,
|
||||
"curly": true,
|
||||
"max-line-length": false,
|
||||
"no-consecutive-blank-lines": true,
|
||||
"no-shadowed-variable": true,
|
||||
"quotemark": [
|
||||
true,
|
||||
"single"
|
||||
],
|
||||
"align": true,
|
||||
"callable-types": false,
|
||||
"forbidden-types": false,
|
||||
"indent": [
|
||||
true,
|
||||
"spaces"
|
||||
],
|
||||
"interface-name": false,
|
||||
"linebreak-style": [
|
||||
true,
|
||||
"LF"
|
||||
],
|
||||
"no-empty-interface": false,
|
||||
"unified-signatures": false,
|
||||
"variable-name": [
|
||||
true,
|
||||
"check-format"
|
||||
],
|
||||
"void-return": false
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user