Skip to content

Latest commit

 

History

History
65 lines (42 loc) · 3 KB

File metadata and controls

65 lines (42 loc) · 3 KB

Here in this chapter we are Started Learning TypeScript from Scratch

- this file is entry file or the first file that need to check as here some of the basics concept will cover

Let's Start Learning TypeScript

  • TypeScript :- -JavaScript with SuperPowers: TypeScript is like a more powerful version of JavaScript,
    • It let's you do everything that JavaScript does, but it adds some extra features to make your life easier,
    • When Writing larger and much more complex programs.
    • TypeScript is JavaScript with syntax for types.

What is TypeScript?

- 01 JavaScript and More :-
        - TypeScript adds additional syntax to JavaScript to support a `tighter integration with your editor`.
        - Catch errors early in your editor.
- 02 A Result You Can Trust :-
        - TypeScript code converts to JavaScript, which `runs anywhere JavaScript runs:` In a browser, on Node.js, Deno, Bun and in your apps.
- 03 Safety at Scale :-
        - TypeScript understands JavaScript and uses `type inference to give you great tooling` without additional code.

Note :-

  • Before installing TypeScript to your machine , make sure to install Nodejs in your machine.

  • website of the nodejs to install :- NodeJS

  • one tip is that try to install LTS version as that means Long Time Support so it have a stable things and much better community support.

  • now to check that NodeJS is being installed or not and which NodeJS version we are using it, use this command to check :- node -v

  • so by entering this command you will like this :- v22.19.0 Note (at this moment i have v22.19.0 installed in your case it may be go higher version as there will be more updates in the future).

TypeScript Installation :-

To Install TypeScript follow this website :- TypeScript

OR

Simply if you want to install typescript globally then use this command in your cmd or terminal 👇 npm install -g typescript

  • now to check that typescript is being installed or not and which typescript version we are using it, use this command to check :- tsc -v

  • so by entering this command you will like this :- Version 7.0.2. Note (at this moment i have version 7 installed in your case it may be go higher version as there will be more updates in the future).

  • now the next step is that open your terminal and type this command in your cmd or terminal 👇 npm i -g ts-node

  • Basic Things to know :-

  • in this part we will create a files that extension is .ts or the .tsx file.

  • so the .tsx or the .ts files are the typescript files means we can write typescript code in it.

NOTE :-

  • at this moment for the tsc -v and the typescript version is 7 so for that there are some issues are there
  • so for the project Learning we are using a command to install typescript and tsc older version.
  • here is the command install it in your project dependencies :-

npm install -D typescript@5.9.2 ts-node@10.9.2