class ABC {
private Name: string;
get name() : string {
return this.Name;
}
set name(setName: string){
this.Name = setName;
}
}
let abc = new ABC();
abc.name = "Albert Thomas"; //set property
console.log('My name is ' + abc.name); //get property
const [elements, setElements] = useState<Set<string>>(new Set<string>())
- To setup simple typescript project follow these step
mkdir ts-proj
cd ts-proj
npm i typescript --save-dev
npx tsc --init
touch index.ts
npx tsc index.ts && node index.js