From 44d372488067acf3881b2dd1f9075105450ea2cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reyes=20Rond=C3=B3n?= <66537220+Reyes1921@users.noreply.github.com> Date: Mon, 4 Mar 2024 09:46:22 -0400 Subject: [PATCH] fix: output length of string (#5227) --- .../101-typescript-types/115-type-assertions/101-as-type.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/data/roadmaps/typescript/content/101-typescript-types/115-type-assertions/101-as-type.md b/src/data/roadmaps/typescript/content/101-typescript-types/115-type-assertions/101-as-type.md index 85c2c5808..6a6767aa9 100644 --- a/src/data/roadmaps/typescript/content/101-typescript-types/115-type-assertions/101-as-type.md +++ b/src/data/roadmaps/typescript/content/101-typescript-types/115-type-assertions/101-as-type.md @@ -9,7 +9,7 @@ Here's a simple example: let someValue: any = "Hello, TypeScript!"; let strLength: number = (someValue as string).length; -console.log(strLength); // Outputs: 20 +console.log(strLength); // Outputs: 18 ``` In this example, someValue is initially of type any, and we use the as operator to assert that it is of type string before accessing its length property. It's important to note that type assertions do not change the underlying runtime representation; they are a compile-time construct used for static type checking in TypeScript.