Skip to content

Commit a7393f5

Browse files
committed
fix: added types for elementRef (#DS-4221)
1 parent 60b1b82 commit a7393f5

File tree

90 files changed

+177
-179
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+177
-179
lines changed

apps/docs/src/app/components/code-snippet/code-snippet.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ import { DocsLocaleState } from 'src/app/services/locale';
1414
export class DocsCodeSnippetDirective extends DocsLocaleState {
1515
private readonly clipboard = inject(Clipboard);
1616
private readonly toastService = inject(KbqToastService);
17-
private readonly elementRef = inject(ElementRef);
17+
private readonly elementRef = inject<ElementRef<HTMLElement>>(ElementRef);
1818

1919
copy() {
20-
if (!this.clipboard.copy(this.elementRef.nativeElement.textContent)) {
20+
if (!this.clipboard.copy(this.elementRef.nativeElement.textContent || '')) {
2121
return;
2222
}
2323

apps/docs/src/app/components/component-viewer/component-viewer.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ export class DocsComponentViewerComponent extends DocsLocaleState {
6868
private readonly sidepanelService = inject(KbqSidepanelService);
6969
private readonly modalService = inject(KbqModalService);
7070
private readonly docStates = inject(DocsDocStates);
71-
private readonly elementRef = inject(ElementRef);
71+
private readonly elementRef = inject<ElementRef<HTMLElement>>(ElementRef);
7272

7373
constructor() {
7474
super();

apps/docs/src/app/components/example-viewer/example-viewer.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,11 @@ export class DocsExampleViewerComponent implements OnDestroy {
6666
this.fetchDocument(url);
6767
}
6868

69-
@Output() readonly contentRendered = new EventEmitter<void>();
70-
@Output() readonly contentRenderFailed = new EventEmitter<void>();
69+
@Output() readonly contentRendered = new EventEmitter<HTMLElement>();
70+
@Output() readonly contentRenderFailed = new EventEmitter<HTMLElement>();
7171

7272
/** The document text. It should not be HTML encoded. */
73-
textContent = '';
73+
textContent: string | null = '';
7474

7575
private static initExampleViewer(exampleViewerComponent: DocsLiveExampleViewerComponent, example: string) {
7676
exampleViewerComponent.example = example;
@@ -79,7 +79,7 @@ export class DocsExampleViewerComponent implements OnDestroy {
7979
constructor(
8080
private appRef: ApplicationRef,
8181
private componentFactoryResolver: ComponentFactoryResolver,
82-
private elementRef: ElementRef,
82+
private elementRef: ElementRef<HTMLElement>,
8383
private injector: Injector,
8484
private viewContainerRef: ViewContainerRef,
8585
private ngZone: NgZone,
@@ -130,7 +130,7 @@ export class DocsExampleViewerComponent implements OnDestroy {
130130
/** Show an error that occurred when fetching a document. */
131131
private showError(url: string, error: HttpErrorResponse) {
132132
console.error(error);
133-
this.elementRef.nativeElement.innerHtml = `Failed to load document: ${url}. Error: ${error.statusText}. <a href="https://github.com/koobiq/angular-components/issues/new" class="kbq-markdown__a">Create issue</a>`;
133+
this.elementRef.nativeElement.innerHTML = `Failed to load document: ${url}. Error: ${error.statusText}. <a href="https://github.com/koobiq/angular-components/issues/new" class="kbq-markdown__a">Create issue</a>`;
134134

135135
this.ngZone.onStable
136136
.pipe(take(1))

apps/docs/src/app/components/icons-viewer/icons-viewer.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ export class DocsIconsViewerComponent extends DocsLocaleState {
6464
private readonly titleService = inject(Title);
6565
private readonly docStates = inject(DocsDocStates);
6666
private readonly changeDetectorRef = inject(ChangeDetectorRef);
67-
private readonly elementRef = inject(ElementRef);
67+
private readonly elementRef = inject<ElementRef<HTMLElement>>(ElementRef);
6868
private readonly destroyRef = inject(DestroyRef);
6969

7070
readonly themePalette = ThemePalette;

apps/docs/src/app/components/live-example-viewer/docs-live-example-viewer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export class DocsLiveExampleViewerComponent extends DocsLocaleState {
7373

7474
private _example: string | null;
7575

76-
private readonly elementRef = inject(ElementRef);
76+
private readonly elementRef = inject<ElementRef<HTMLElement>>(ElementRef);
7777
private readonly httpClient = inject(HttpClient);
7878
private readonly cdr = inject(ChangeDetectorRef);
7979
private readonly window = inject(KBQ_WINDOW);

apps/docs/src/app/components/live-example/docs-live-example.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ export class DocsLiveExampleComponent extends DocsLocaleState implements OnDestr
8888

8989
private readonly appRef = inject(ApplicationRef);
9090
private readonly componentFactoryResolver = inject(ComponentFactoryResolver);
91-
private readonly elementRef = inject(ElementRef);
91+
private readonly elementRef = inject<ElementRef<HTMLElement>>(ElementRef);
9292
private readonly injector = inject(Injector);
9393
private readonly viewContainerRef = inject(ViewContainerRef);
9494
private readonly ngZone = inject(NgZone);

apps/docs/src/app/components/register-header/register-header.directive.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { DocsDocStates } from '../../services/doc-states';
77
})
88
export class DocsRegisterHeaderDirective {
99
private readonly docStates = inject(DocsDocStates);
10-
private readonly elementRef = inject(ElementRef);
10+
private readonly elementRef = inject<ElementRef<HTMLElement>>(ElementRef);
1111

1212
constructor() {
1313
this.docStates.registerHeader(this.elementRef.nativeElement);

apps/docs/src/app/components/stackblitz/stackblitz-button.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export class DocsStackblitzButtonComponent extends KbqLink {
4343
private openStackBlitzFn: (() => void) | null = null;
4444

4545
constructor(
46-
elementRef: ElementRef,
46+
elementRef: ElementRef<HTMLAnchorElement>,
4747
focusMonitor: FocusMonitor,
4848
changeDetector: ChangeDetectorRef,
4949
private stackBlitzWriter: DocsStackblitzWriter,

apps/docs/src/app/components/welcome/welcome.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export class DocsWelcomeComponent extends DocsLocaleState implements OnInit {
3333
protected structureCategories: DocsStructureCategory[];
3434
currentTheme$: Observable<string>;
3535

36-
private readonly elementRef = inject(ElementRef);
36+
private readonly elementRef = inject<ElementRef<HTMLElement>>(ElementRef);
3737
private readonly docStates = inject(DocsDocStates);
3838

3939
constructor(private readonly themeService: ThemeService) {

packages/components-dev/toast/module.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export class DevToastComponent extends KbqToastComponent {
3838
constructor(
3939
readonly data: KbqToastData,
4040
readonly service: KbqToastService,
41-
elementRef: ElementRef,
41+
elementRef: ElementRef<HTMLElement>,
4242
focusMonitor: FocusMonitor
4343
) {
4444
super(data, service, elementRef, focusMonitor);

0 commit comments

Comments
 (0)