]> juplo.de Git - demos/kafka/chat/commitdiff
fix: Fixed compile issues after upgrade
authorKai Moritz <kai@juplo.de>
Wed, 17 Sep 2025 19:22:12 +0000 (21:22 +0200)
committerKai Moritz <kai@juplo.de>
Fri, 19 Sep 2025 10:52:22 +0000 (12:52 +0200)
src/app/user/user.component.ts

index 4e62e96641f9a2273d6089dfe44dd0fa070ea811..4919f1cf697951cd695454f6531145619970aba5 100644 (file)
@@ -1,6 +1,9 @@
 import { Component } from '@angular/core';
-import { FormControl } from '@angular/forms';
-import { Validators } from '@angular/forms';
+import {
+  FormControl,
+  Validators,
+  ValidationErrors,
+} from '@angular/forms';
 import { Router } from "@angular/router";
 import { UserService } from "./user.service";
 
@@ -14,17 +17,17 @@ export class UserComponent {
   usernameForm = new FormControl('', [ Validators.required, this.noWhitespaceValidator ]);
 
   updateName(): void {
-    var input = this.usernameForm.getRawValue();
+    let input = this.usernameForm.getRawValue();
     if (input !== null) {
       this.userService.setUser(input.trim());
       this.router.navigate(['chatrooms'])
     }
   }
 
-  noWhitespaceValidator(control: FormControl) {
+  noWhitespaceValidator(control: FormControl) : ValidationErrors {
     const isWhitespace = (control.value || '').trim().length === 0;
     const isValid = !isWhitespace;
-    return isValid ? null : { 'whitespace': true };
+    return isValid ? {} : { 'whitespace': true };
   }
 
   constructor(