How to get the type of another variable in TypeScript?
Originally Published Here ๐!
To get the type of another variable, you can use the typeof type operator in TypeScript.
TL;DR
// a simple variable
let firstName = "John Doe";
// get the type of variable `firstName`
type SimpleType = typeof firstName;...
melvingeorge-me.hashnode.dev1 min read