From b7a678c4ab58b18546b6595df3848bf2e994a42a Mon Sep 17 00:00:00 2001 From: Fazilat Jahan <160049943+Fazilat-Jahan@users.noreply.github.com> Date: Sat, 27 Jul 2024 22:51:53 +0500 Subject: [PATCH] Update app.ts --- step00c_type_error/app.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/step00c_type_error/app.ts b/step00c_type_error/app.ts index 0a850c79..5d98f75d 100644 --- a/step00c_type_error/app.ts +++ b/step00c_type_error/app.ts @@ -1,3 +1,7 @@ -let message = "Hello World"; -console.loger(message); - +// A type error in TypeScript occurs when a value is used in a way that is incompatible with its declared type. + +let myName: string = "unknown person" +myName = 4 // Here, try to assign the number 4 to variable `myName`. Since `myName` is type string, TypeScript will throw a type error: Type 'number' is not assignable to type 'string'. + +console.log(myName); +