Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

type assertions in typescript

//similar to typeCasting in other languages
//using as
const myVar = (req.query.param as unknown) as string;
//using angle bracket notation
const myVar = <string> (<unknown> req.query.param);
 
PREVIOUS NEXT
Tagged: #type #assertions #typescript
ADD COMMENT
Topic
Name
3+7 =