Skip to content

Commit 9a913dc

Browse files
MeAkibkirjs
authored andcommitted
docs(docs-infra): clean up code and use inferred types where possible (angular#64139)
PR Close angular#64139
1 parent 04462ed commit 9a913dc

File tree

7 files changed

+10
-16
lines changed

7 files changed

+10
-16
lines changed

adev/shared-docs/components/cookie-popup/cookie-popup.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export class CookiePopup {
2727
private readonly localStorage = inject(LOCAL_STORAGE);
2828

2929
/** Whether the user has accepted the cookie disclaimer. */
30-
readonly hasAccepted = signal<boolean>(false);
30+
readonly hasAccepted = signal(false);
3131

3232
constructor() {
3333
// Needs to be in a try/catch, because some browsers will

adev/shared-docs/components/navigation-list/navigation-list.component.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ import {IconComponent} from '../icon/icon.component';
1414
import {IsActiveNavigationItem} from '../../pipes';
1515
import {NgTemplateOutlet, TitleCasePipe} from '@angular/common';
1616
import {MatTooltipModule} from '@angular/material/tooltip';
17-
import {SlideToggle} from '../slide-toggle/slide-toggle.component';
18-
import {FormControl, ReactiveFormsModule} from '@angular/forms';
17+
import {ReactiveFormsModule} from '@angular/forms';
1918

2019
@Component({
2120
selector: 'docs-navigation-list',
@@ -35,10 +34,10 @@ import {FormControl, ReactiveFormsModule} from '@angular/forms';
3534
})
3635
export class NavigationList {
3736
readonly navigationItems = input.required<NavigationItem[]>();
38-
readonly displayItemsToLevel = input<number>(2);
37+
readonly displayItemsToLevel = input(2);
3938
readonly collapsableLevel = input<number | undefined>();
40-
readonly expandableLevel = input<number>(2);
41-
readonly isDropdownView = input<boolean>(false);
39+
readonly expandableLevel = input(2);
40+
readonly isDropdownView = input(false);
4241

4342
readonly linkClicked = output<void>();
4443

adev/shared-docs/components/select/select.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export class Select implements ControlValueAccessor {
3737
readonly id = input.required<string>({alias: 'selectId'});
3838
readonly name = input.required<string>();
3939
readonly options = input.required<SelectOption[]>();
40-
readonly disabled = model<boolean>(false);
40+
readonly disabled = model(false);
4141

4242
// Implemented as part of ControlValueAccessor.
4343
private onChange: (value: SelectOptionValue) => void = (_: SelectOptionValue) => {};

adev/shared-docs/components/slide-toggle/slide-toggle.component.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import {ControlValueAccessor, NG_VALUE_ACCESSOR} from '@angular/forms';
1111

1212
@Component({
1313
selector: 'docs-slide-toggle',
14-
imports: [],
1514
changeDetection: ChangeDetectionStrategy.OnPush,
1615
templateUrl: './slide-toggle.component.html',
1716
styleUrls: ['./slide-toggle.component.scss'],
@@ -26,7 +25,7 @@ import {ControlValueAccessor, NG_VALUE_ACCESSOR} from '@angular/forms';
2625
export class SlideToggle implements ControlValueAccessor {
2726
readonly buttonId = input.required<string>();
2827
readonly label = input.required<string>();
29-
readonly disabled = model<boolean>(false);
28+
readonly disabled = model(false);
3029

3130
// Implemented as part of ControlValueAccessor.
3231
private onChange: (value: boolean) => void = (_: boolean) => {};

adev/src/app/app-scroller.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export class AppScroller {
6262
this.scroll();
6363
});
6464

65-
// This value is primarly intended to offset the scroll position on mobile when the menu is on the top.
65+
// This value is primarily intended to offset the scroll position on mobile when the menu is on the top.
6666
// But on desktop, it doesn't hurt to have a small offset either.
6767
this.viewportScroller.setOffset([0, 64]);
6868
}

adev/src/app/core/services/theme-manager.service.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import {DOCUMENT, isPlatformBrowser} from '@angular/common';
1010
import {Injectable, PLATFORM_ID, inject, signal} from '@angular/core';
1111
import {LOCAL_STORAGE} from '@angular/docs';
12-
import {Subject} from 'rxjs';
1312

1413
// Keep these constants in sync with the code in index.html
1514

@@ -29,8 +28,6 @@ export class ThemeManager {
2928
private readonly platformId = inject(PLATFORM_ID);
3029

3130
readonly theme = signal<Theme | null>(this.getThemeFromLocalStorageValue());
32-
// Zoneless - it's required to notify that theme was changed. It could be removed when signal-based components will be available.
33-
readonly themeChanged$ = new Subject<void>();
3431

3532
constructor() {
3633
if (!isPlatformBrowser(this.platformId)) {
@@ -67,7 +64,6 @@ export class ThemeManager {
6764
documentClassList.add(LIGHT_MODE_CLASS_NAME);
6865
documentClassList.remove(DARK_MODE_CLASS_NAME);
6966
}
70-
this.themeChanged$.next();
7167
}
7268

7369
private getThemeFromLocalStorageValue(): Theme | null {

adev/src/app/main.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* found in the LICENSE file at https://angular.dev/license
77
*/
88

9-
import {Component, effect, inject, model, WritableSignal} from '@angular/core';
9+
import {Component, effect, inject, model} from '@angular/core';
1010
import {IS_SEARCH_DIALOG_OPEN, Search} from '@angular/docs';
1111
import {RouterOutlet} from '@angular/router';
1212

@@ -16,7 +16,7 @@ import {RouterOutlet} from '@angular/router';
1616
template: `<router-outlet />`,
1717
})
1818
export default class MainComponent {
19-
private readonly displaySearchDialog: WritableSignal<boolean> = inject(IS_SEARCH_DIALOG_OPEN);
19+
private readonly displaySearchDialog = inject(IS_SEARCH_DIALOG_OPEN);
2020
private readonly searchService = inject(Search);
2121
readonly search = model<string | undefined>('');
2222

0 commit comments

Comments
 (0)