Skip to content
This repository was archived by the owner on Mar 21, 2025. It is now read-only.

Commit 0059b19

Browse files
committed
build: enable strict TypeScript compiler flags
add `.nvmrc`
1 parent d5cfc25 commit 0059b19

File tree

3 files changed

+28
-19
lines changed

3 files changed

+28
-19
lines changed

.nvmrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
12

projects/dev/src/lib/button-bar/button-bar.component.ts

+21-19
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import {Subscription} from 'rxjs';
99
styleUrls: ['./button-bar.component.scss']
1010
})
1111
export class ButtonBarComponent implements OnInit, OnDestroy {
12-
@Input() navItems: NavItem[];
13-
watcher: Subscription;
12+
@Input() navItems: NavItem[] | undefined;
13+
watcher: Subscription | undefined;
1414
namedButtons: NavItem[] = [];
1515
iconButtons: NavItem[] = [];
1616
overflowMenuItems: NavItem[] = [];
@@ -30,25 +30,27 @@ export class ButtonBarComponent implements OnInit, OnDestroy {
3030
}
3131

3232
onMediaChange() {
33-
const items = this.navItems.slice();
34-
this.namedButtons = [];
35-
this.iconButtons = [];
36-
this.overflowMenuItems = [];
33+
if (this.navItems) {
34+
const items = this.navItems.slice();
35+
this.namedButtons = [];
36+
this.iconButtons = [];
37+
this.overflowMenuItems = [];
3738

38-
if (this.mediaService.isActive('xs')) {
39-
this.iconButtons = this.iconButtons.concat(items.splice(0, 5));
40-
} else if (this.mediaService.isActive('sm')) {
41-
this.namedButtons = this.namedButtons.concat(items.splice(0, 6));
42-
} else if (this.mediaService.isActive('md')) {
43-
this.namedButtons = this.namedButtons.concat(items.splice(0, 8));
44-
} else if (this.mediaService.isActive('lg')) {
45-
this.namedButtons = this.namedButtons.concat(items.splice(0, 12));
46-
} else if (this.mediaService.isActive('xl')) {
47-
this.namedButtons = this.namedButtons.concat(items.splice(0, 16));
48-
}
39+
if (this.mediaService.isActive('xs')) {
40+
this.iconButtons = this.iconButtons.concat(items.splice(0, 5));
41+
} else if (this.mediaService.isActive('sm')) {
42+
this.namedButtons = this.namedButtons.concat(items.splice(0, 6));
43+
} else if (this.mediaService.isActive('md')) {
44+
this.namedButtons = this.namedButtons.concat(items.splice(0, 8));
45+
} else if (this.mediaService.isActive('lg')) {
46+
this.namedButtons = this.namedButtons.concat(items.splice(0, 12));
47+
} else if (this.mediaService.isActive('xl')) {
48+
this.namedButtons = this.namedButtons.concat(items.splice(0, 16));
49+
}
4950

50-
if (items.length > 0) {
51-
this.overflowMenuItems = items;
51+
if (items.length > 0) {
52+
this.overflowMenuItems = items;
53+
}
5254
}
5355
}
5456
}

tsconfig.json

+6
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
44
"baseUrl": "./",
55
"downlevelIteration": true,
66
"outDir": "./dist/out-tsc",
7+
"noImplicitAny": true,
8+
"noImplicitReturns": true,
9+
"noImplicitThis": true,
10+
"noFallthroughCasesInSwitch": true,
11+
"strictNullChecks": true,
12+
"strictPropertyInitialization": true,
713
"sourceMap": true,
814
"declaration": false,
915
"module": "esnext",

0 commit comments

Comments
 (0)