From 608906c363ddf5862e779de0013d2804e6bf6e5e Mon Sep 17 00:00:00 2001 From: Fazilat Jahan <160049943+Fazilat-Jahan@users.noreply.github.com> Date: Sat, 27 Jul 2024 22:53:59 +0500 Subject: [PATCH] Update app.ts --- step00d_assignability_error/app.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/step00d_assignability_error/app.ts b/step00d_assignability_error/app.ts index d0b4b9ed..22d740c3 100644 --- a/step00d_assignability_error/app.ts +++ b/step00d_assignability_error/app.ts @@ -1,4 +1,6 @@ -let message = "Hello World"; -message = 6; -console.log(message); - +//An assignability error in TypeScript occurs when you attempt to assign a value to a variable or property in a way that does not conform to its declared type. + +let myName: string +myName = 22 // Here, trying to assign the number 22 to myName. Since myName is declared to hold only string values, TypeScript throws an assignability error: Type 'number' is not assignable to type 'string' + +console.log(myName);