TypeScript Classes Tutorial for JavaScript Developers

TypeScript Classes Tutorial for JavaScript Developers

In This tutorial we will learn about Classes, member variable, constructor, member functions in TypeScript. We will code examples of Classes & see the results.

Class - TypeScript adds types and visibility modifiers to JavaScript classes.

1.?????? Members: Types - The members of a class (properties & methods) are typed using type annotations, similar to variables.

?

2.?????? Members: Visibility - Class members also be given special modifiers which affect visibility. There are three main visibility modifiers in TypeScript.

a.?????? public - (default) allows access to the class member from anywhere

b.?????? private - only allows access to the class member from within the class

c.?????? protected - allows access to the class member from itself and any classes that inherit it, which is covered in the inheritance section below

?

3.?????? Parameter Properties - TypeScript provides a convenient way to define class members in the constructor, by adding a visibility modifiers to the parameter.

?

4.?????? Readonly - Similar to arrays, the readonly keyword can prevent class members from being changed.

?

5.?????? Inheritance: Implements - Interfaces (covered here) can be used to define the type a class must follow through the implements keyword. A class can implement multiple interfaces by listing each one after implements, separated by a comma.

?

6.?????? Inheritance: Extends - Classes can extend each other through the extends keyword. A class can only extends one other class.

?

7.?????? Override When a class extends another class, it can replace the members of the parent class with the same name. Newer versions of TypeScript allow explicitly marking this with the override keyword.

?

8.?????? Abstract Classes - Classes can be written in a way that allows them to be used as a base class for other classes without having to implement all the members. This is done by using the abstract keyword. Members that are left unimplemented also use the abstract keyword.

?

?

Topic Covered

1.?????? Welcome to Tutorial

2.?????? Agenda of Tutorial

3.?????? Class in TypeScript

4.?????? Class Member Types

5.?????? Member Visibility

6.?????? Parameter Properties

7.?????? Readonly Properties

8.?????? Inheritance Implements

9.?????? Inheritance Extends

10.?? Overriding Methods

11.?? Abstract Classes

12.?? Running the code

13.?? GIT Repository

?

CHAPTER

0:00 Welcome to Tutorial

0:30 Previous Video – Recap

1:13 Agenda of Tutorial

2:27 Class in TypeScript

3:16 Class Member Types

4:44 Member Visibility

7:35 Parameter Properties

9:29 Readonly Properties

11:54 Inheritance Implements

13:34 Inheritance Extends

14:58 Overriding Methods

15:41 Abstract Classes

17:39 Running the code

18:52 GIT Repository

?

#typescript

?

Previous Video Tutorial

TypeScript Function & Casting Tutorial for JavaScript Developers | #typescripttutorial

https://youtu.be/HmPfntT63Ns

?

?

TypeScript Complete Tutorial Playlist

https://www.youtube.com/playlist?list=PL2NZAYdLkYvhbvtzYuWaLSxe5p7eWCbTo

?

GIT Repository

https://github.com/codeonedigest/TypeScriptCompleteTutorial

?

CHECK OUT OUR OTHER VIDEOS

Shopify Ecommerce & Retail POS tutorial for Commerce Developer https://youtube.com/shorts/9gFn1FcXaL4?feature=share

Create AWS EC2 Instance and Run Springboot Microservice and MongoDB in EC2 Server

https://youtu.be/FI2M61Cotpw

Introduction to Salesforce Commerce Cloud https://youtube.com/shorts/V9LC7ZUFeM8?feature=share

Kubernetes Tutorial for Beginners https://youtube.com/shorts/aygEGpIIGv0?feature=share

Kubernetes Architecture Component & Cluster https://youtube.com/shorts/CogT46yLBF4?feature=share

Kubernetes Node Affinity Taints & Tolerations https://youtube.com/shorts/BfLD9k4D9o8?feature=share

Why Python is Number1 language https://www.youtube.com/shorts/YgBKYKy0xto

What is Python function? https://www.youtube.com/shorts/dcGy7v6RxOQ

?

CHECK OUR PLAYLISTS

Shopify Ecommerce & Retail POS playlist https://www.youtube.com/playlist?list=PL2NZAYdLkYvhJTo-bewt5UwvWladmRpnk

AWS Cloud and Docker Containers Complete Tutorial

https://youtube.com/playlist?list=PL2NZAYdLkYvhZQo2VTVCSug_zVjekNodi

Salesforce commerce cloud SFCC B2B B2C SFMC Capabilities https://www.youtube.com/playlist?list=PL2NZAYdLkYviJnkM92HZoadf_sRDQgLvs

CodeOneDigest Learning Shorts

https://youtube.com/playlist?list=PL2NZAYdLkYvhwdsvjUr7gw6jVb2IgyE07

Kubernetes Cluster Architecture Master & Worker Node Tutorial? https://youtube.com/playlist?list=PL2NZAYdLkYviE7B06At6INbSCsDSRX8Ya

Complete Python Learning Tutorial Playlist

https://www.youtube.com/playlist?list=PL2NZAYdLkYvhkIFy2Lq7yZX_jUCC0UBYR

Spring Boot Complete Tutorial https://youtube.com/playlist?list=PL2NZAYdLkYvg_VlNmszrb-Um0wRx5yGDF

?

ABOUT OUR CHANNEL

CodeOneDigest is a youtube channel for the videos on programming language, cloud and docker container technology in English and Hindi languages.

Dosto, CodeOneDigest youtube channel pe aapko programming languages, container technology, cloud computing, software engineering se related videos milenge.

Check out our channel here:

https://www.youtube.com/channel/UC9V0QYsWKz_OD2uooCtEtRg

Don’t forget to subscribe!

?

OUR WEBSITE

https://codeonedigest.wordpress.com/

?

GET IN TOUCH

Contact us on [email protected]

?

FOLLOW US ON SOCIAL - LIKE, SHARE & SUBSCRIBE

Get updates or reach out to Get updates on our Social Media Profiles!

Subscribe: https://bit.ly/3NeWQ8U

Youtube: https://www.youtube.com/channel/UC9V0QYsWKz_OD2uooCtEtRg

Twitter: https://twitter.com/codeonedigest

Facebook: https://www.facebook.com/codeonedigest

Instagram: https://www.instagram.com/codeonedigest/

Linkedin: https://www.dhirubhai.net/in/codeone-digest-10b418255/

Reddit: https://www.reddit.com/user/codeonedigest

Github: https://github.com/codeonedigest

Website: https://codeonedigest.wordpress.com/

Tumblr: https://www.tumblr.com/codeonedigest

Pinterest: https://in.pinterest.com/codeonedigest/

要查看或添加评论,请登录

社区洞察

其他会员也浏览了