Skip to content

Commit ea69c14

Browse files
committed
Merge pull request #881 from masimakopoulos/style/typescriptImprovements
Style/typescript improvements
2 parents f80931a + f4d146a commit ea69c14

File tree

13 files changed

+24
-35
lines changed

13 files changed

+24
-35
lines changed

generators/app/templates/src/app/_index.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/** @ngInject */
2-
export function config($logProvider: ng.ILogProvider, toastrConfig: any) {
2+
export function config($logProvider: angular.ILogProvider, toastrConfig: any) {
33
// enable log
44
$logProvider.debugEnabled(true);
55
// set options third-party lib
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
/** @ngInject */
2-
export function runBlock($log: ng.ILogService) {
2+
export function runBlock($log: angular.ILogService) {
33
$log.debug('runBlock end');
44
}

generators/app/templates/src/app/_ngroute/__ngroute.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/** @ngInject */
2-
export function routerConfig($routeProvider: ng.route.IRouteProvider) {
2+
export function routerConfig($routeProvider: angular.route.IRouteProvider) {
33
$routeProvider
44
.when('/', {
55
templateUrl: 'app/main/main.html',

generators/app/templates/src/app/_uirouter/__uirouter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/** @ngInject */
2-
export function routerConfig($stateProvider: ng.ui.IStateProvider, $urlRouterProvider: ng.ui.IUrlRouterProvider) {
2+
export function routerConfig($stateProvider: angular.ui.IStateProvider, $urlRouterProvider: angular.ui.IUrlRouterProvider) {
33
$stateProvider
44
.state('home', {
55
url: '/',

generators/app/templates/src/app/components/githubContributor/_githubContributor.service.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ describe('service githubContributor', () => {
88
}));
99

1010
describe('getContributors function', () => {
11-
it('should return data', inject((githubContributor: GithubContributor, $httpBackend: ng.IHttpBackendService) => {
11+
it('should return data', inject((githubContributor: GithubContributor, $httpBackend: angular.IHttpBackendService) => {
1212
$httpBackend.when('GET', githubContributor.apiHost + '/contributors?per_page=1').respond(200, [{pprt: 'value'}]);
1313
let data: any[];
1414
githubContributor.getContributors(1).then((fetchedData: any[]) => {
@@ -19,7 +19,7 @@ describe('service githubContributor', () => {
1919
expect(data[0]).not.toBeNull();
2020
}));
2121

22-
it('should define a limit per page as default value', inject((githubContributor: GithubContributor, $httpBackend: ng.IHttpBackendService) => {
22+
it('should define a limit per page as default value', inject((githubContributor: GithubContributor, $httpBackend: angular.IHttpBackendService) => {
2323
$httpBackend.when('GET', githubContributor.apiHost + '/contributors?per_page=30').respond(200, new Array(30));
2424
var data: any[];
2525
githubContributor.getContributors().then((fetchedData: any[]) => {
@@ -29,7 +29,7 @@ describe('service githubContributor', () => {
2929
expect(data.length === 30).toBeTruthy();
3030
}));
3131

32-
it('should log a error', inject((githubContributor: GithubContributor, $httpBackend: ng.IHttpBackendService, $log: ng.ILogService) => {
32+
it('should log a error', inject((githubContributor: GithubContributor, $httpBackend: angular.IHttpBackendService, $log: angular.ILogService) => {
3333
$httpBackend.when('GET', githubContributor.apiHost + '/contributors?per_page=1').respond(500);
3434
githubContributor.getContributors(1);
3535
$httpBackend.flush();

generators/app/templates/src/app/components/githubContributor/_githubContributor.service.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
11
export class GithubContributor {
22
public apiHost: string = 'https://api.github.com/repos/Swiip/generator-gulp-angular';
33

4-
private $log: ng.ILogService;
5-
private $http: ng.IHttpService;
6-
74
/** @ngInject */
8-
constructor($log: ng.ILogService, $http: ng.IHttpService) {
9-
this.$log = $log;
10-
this.$http = $http;
5+
constructor(private $log: angular.ILogService, private $http: angular.IHttpService) {
6+
117
}
128

13-
getContributors(limit: number = 30): ng.IPromise<any[]> {
9+
getContributors(limit: number = 30): angular.IPromise<any[]> {
1410
return this.$http.get(this.apiHost + '/contributors?per_page=' + limit)
1511
.then((response: any): any => {
1612
return response.data;

generators/app/templates/src/app/components/malarkey/_malarkey.directive.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ import { GithubContributor } from '../githubContributor/githubContributor.servic
88
* (malarkey usage, addClass, $watch, $destroy)
99
*/
1010
describe('directive malarkey', () => {
11-
let element: ng.IAugmentedJQuery;
11+
let element: angular.IAugmentedJQuery;
1212
let malarkeyController: MalarkeyController;
1313

1414
beforeEach(angular.mock.module('<%- appName %>'));
1515

16-
beforeEach(inject(($compile: ng.ICompileService, $rootScope: ng.IRootScopeService, githubContributor: GithubContributor, $q: ng.IQService) => {
16+
beforeEach(inject(($compile: angular.ICompileService, $rootScope: angular.IRootScopeService, githubContributor: GithubContributor, $q: angular.IQService) => {
1717
spyOn(githubContributor, 'getContributors').and.callFake(() => {
1818
return $q.when([{}, {}, {}, {}, {}, {}]);
1919
});
@@ -37,7 +37,7 @@ describe('directive malarkey', () => {
3737
expect(malarkeyController.contributors.length).toEqual(6);
3838
});
3939

40-
it('should log a info', inject(($log: ng.ILogService) => {
40+
it('should log a info', inject(($log: angular.ILogService) => {
4141
expect($log.info.logs).toEqual(jasmine.stringMatching('Activated Contributors View'));
4242
}));
4343
});

generators/app/templates/src/app/components/malarkey/_malarkey.directive.ts

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import { GithubContributor } from '../githubContributor/githubContributor.service';
22

3-
interface IProjectsScope extends ng.IScope {
3+
interface IProjectsScope extends angular.IScope {
44
extraValues: any[];
55
}
66

77
/** @ngInject */
8-
export function acmeMalarkey(malarkey: any): ng.IDirective {
8+
export function acmeMalarkey(malarkey: any): angular.IDirective {
99

1010
return {
1111
restrict: 'E',
@@ -55,18 +55,11 @@ export interface IContributor {
5555
/** @ngInject */
5656
export class MalarkeyController {
5757
public contributors: any[];
58-
public malarkey: any;
5958

60-
private $log: ng.ILogService;
61-
private githubContributor: GithubContributor;
6259

63-
constructor($log: ng.ILogService, githubContributor: GithubContributor, malarkey: any) {
60+
constructor(private $log: angular.ILogService, private githubContributor: GithubContributor, private malarkey: any) {
6461
this.contributors = [];
6562

66-
this.$log = $log;
67-
this.githubContributor = githubContributor;
68-
this.malarkey = malarkey;
69-
7063
this.activate();
7164
}
7265

generators/app/templates/src/app/components/navbar/_navbar.directive.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ import { NavbarController } from './navbar.directive';
66
* Test should check if MomentJS have been called
77
*/
88
describe('directive navbar', function() {
9-
let element: ng.IAugmentedJQuery;
9+
let element: angular.IAugmentedJQuery;
1010
let navbarController: NavbarController;
1111
let timeInMs: number;
1212

1313
beforeEach(angular.mock.module('<%- appName %>'));
1414

15-
beforeEach(inject(($compile: ng.ICompileService, $rootScope: ng.IRootScopeService) => {
15+
beforeEach(inject(($compile: angular.ICompileService, $rootScope: angular.IRootScopeService) => {
1616
const currentDate: Date = new Date();
1717
timeInMs = currentDate.setHours(currentDate.getHours() - 24);
1818

generators/app/templates/src/app/components/navbar/_navbar.directive.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/** @ngInject */
2-
export function acmeNavbar(): ng.IDirective {
2+
export function acmeNavbar(): angular.IDirective {
33

44
return {
55
restrict: 'E',

0 commit comments

Comments
 (0)