Skip to content

Commit

Permalink
Remove duplication (#5311)
Browse files Browse the repository at this point in the history
  • Loading branch information
boc-the-git authored Mar 11, 2024
1 parent cd62320 commit da526fa
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ let strLength: number = (someValue as string).length;

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.
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 runtime type of a value, and do not cause any type of conversion. They simply provide a way for the programmer to override the type inference performed by the compiler.
It's important to note that type assertions do not change the runtime type of a value, and do not cause any type of conversion. They are a compile-time construct used for static type checking in TypeScript.

- [Type assertions](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#type-assertions)

0 comments on commit da526fa

Please sign in to comment.