What is typescript? and What are its advantages?

Typescript is a superset of JS. It’s a programming languge with additinal syntax. TypeScript builds on top of JavaScript. The following pictcure shows the relationship between the two.

First, you write the TypeScript code. Then, you compile the TypeScript code into plain JavaScript code using a TypeScript compiler(tsc).

TypeScript uses the JavaScript syntaxes and adds additional syntaxes for supporting data types. Note that Javascript is dynamically typed languge meaning if there is any error in the code, it’s caught at runtime and the program doesn’t terminate gracefully. Using typescript helps to identify errors at compile time.

why typescript?

typescript adds data-type feature which helps to identify error at compile time. Thus, it forces us to write robust, clean and less error-prone code. For example. let’s say we want to write a function that adds two numbers, num1 and num2. If we write this function in javascript and without any additional validation, we will get unwanted result(string concatination rather than addition). Look at the screenshots below for further illustration.

the screenshot below shows simple index.html page with two input filed and button to add the two numbers.

index.html page –> here we include script.js file

the screenshot below shows the script.js file where we define our add function.

script.js file (note this isn’t typescript file, this is plain javascript file)

if we open index.html file and put some numbers in the input field, and press add button. we won’t get the exepected result in the console. Rather we get concatination of string values.

console output

Now by using typescript we can write more robust code and enforce we are getting numbers insted of string values. Thus avoid runtime errors or unexpected results in our case. The screenshot below shows an example of typescript.

script.ts (this is typescript file with additinal syntax shown with yellow underlines)

Now, we can compile this file by using typescript compiler(tsc) and run the command ‘tsc script.ts’. This command will compile our code and produce ‘script.js’ file. Below is the console output after compiling this code.

console output after running typescript

Thus using typescript we can write clean and more robust code.

Additional advantage of using typescript

Apart from writing more robust and less-error prone code, typescript has the following advantages

  1. we can use next generation Javascript features and everyting we write compiles down to js code.
  2. we can use features like interface and generics that helps during development.
  3. It has rich configuration options

Disadvantage of using typescript

Although typescript provides lots of feature, one drawback is that neither broswer nor node can execute typescript file. That is why we have tsc tool (typescript compiler) to compile our code back to plain Javascript so that our browser can interpret it.

How to install it?

Inorder to start using typescript we need to install it using npm. Below is a command to install typescript globally.

npm install -g typescript

Usefull GitHub commands

Build – npm run build

Run – npm start

Check Git – git remote -v

Clone

git remote set-url origin https://github.com/TopOneUK/CRM

git clone https://github.com/TopOne/CRM D:\GoogleDrive\GitHUB\TopOne.CRM

Create – npx create-react-app TestPopUp

Config

git config –global user.email “Mario.Zbikowskil@TopOneCRM.com”

git config –global user.name “TopOneMario”

Node.js

Others

git init
npm cache clean --force
  • npm rebuild
  • npm i react-scripts
  • npm install styled-components
  • npm i request –save

Windows 11

Get a fresh perspective. Windows 11 provides a calm and creative space where you can pursue your passions through a fresh experience.

Value every second because time waits for nobody

They say ” Time is more valuable than money. You can get more money but you can not get more time.”

We at TopOne value BOTH your time and money which is why we are here to offer you TopOneTest. This service revolves around software and technique testing.

Outsource with us and accelerate your digital transformation. TopOne’s experienced QA & Testing teams deliver dream-team outcomes without the hassles of hiring testers.

Web Portal

Windows 10 Quick Assist to remotely troubleshoot PC problems

Quick Assist is a remote assistance tool that allows Windows 10 users to receive and give assistance by taking control of a remote computer.

How does Quick Assist Work?

The person giving assistance and who will be taking over control of the computer is called the Helper.

If you are running Windows 10 and the Fall Creators Update is installed, Quick Assist is already installed by default. To start the program, simply click on the Start Button and type Quick Assist into the search field.

Starting Quick Assist

When you start Quick Assist, you will be greeted by a prompt asking if you wish to Get assistance or Give assistance.

Give or Receive Assistance

If you are the Helper you would click on Give assistance and be prompted to login to your Windows account. Once you login, you will be shown a code and how long its good for. This code is used by the person getting assistance, or Host, to make a connection back to you. For the Host, when you click Get assistance you will be prompted to enter a code given to you by the person helping you.

Give Assistance Screen
Get Assistance Screen

Left: Get Assistance Screen (Host), Right: Give Assistance Screen (Helper)

Once you have followed the steps above the Host will see a final prompt asking if they’d like to share their screen with the Helper. Accept this and the helper will now have access to your machine and control it from their own computer, which is great for troubleshooting. However please make sure the Helper is someone you know or a trustworthy troubleshoot company.

MS Teams

While working from home Microsoft teams keeps all team members connected by making work visible, integrated and accessible.

In order to take advantage of this communication platform that integrates workplace chat, video meetings, file storage, and application – head on over to TopOneUK and book a consultation call or email us via request@topone.uk.

Book your consultation call today and get 10% off.