Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

type casting in typescript

let x:unknown = "abcder";
console.log((x as string).length)
/*we turn something into a string*/
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #type #casting #typescript
ADD COMMENT
Topic
Name
1+6 =