Is just typing the difference between Typescript and Javascript?

Hi, Devs!

So, the Typescript language came out and rapidly was being used around the Dev World. The important think is always use de correct tool to answer the problem, either Typescript or Javascript, or even other language.

To know import…


This content originally appeared on DEV Community and was authored by Luiz Calaça

Hi, Devs!

So, the Typescript language came out and rapidly was being used around the Dev World. The important think is always use de correct tool to answer the problem, either Typescript or Javascript, or even other language.

To know important characteristics/concepts in programming we need to go back and read the literature about Computer Science and the essentials of languages.

A good example to learn is about transpiler, because the Typescript transpiler converts Typescript code to JavaScript.

And to answer the question of the title: Absolutely there are a lot of differences. And to get start, let's go to learn some concepts.

## const printJ = () => {return 'Javascript'}

What is dynamic typing?

Dynamically-typed languages perform type checking at runtime.

What is functional programming?

That's a programming paradigm where programs are constructed by applying and composing functions.

## const printT = (): string => {return 'Typescript'}

What is static typing?

Statically typed languages perform type checking at compile time.

What is oriented object programming (OOP)?

That's a programming paradigm where programs are modeled by applying objects (classes, interfaces, abstract class, inheritance)

programming paradigm

Typescript has classes, Javascript not:

class Person {
   private name: string = ''
   private age: number = 0

   constructor(name: string, age: number){
      this.name = name
      this.age = age
   }

   getName(): string { return this.name }

   getAge(): number { return this.age }
}

const teste = new Person('Calaça', 32)
console.log(teste.getName())

Typescript has Interface, Javascript not:

interface Person {
    firstName: string;
    lastName: string;
}

let john: Person = {
    firstName: 'Luiz',
    lastName: 'Calaça'
}

Typescript has Enum, Javascript not:

enum State {
    Progress = "In Progress",
    Finished = "Finished",
    NotCompleted = "Not completed "
}

//State.Progress

Typescript has Generics, Javascript not:

export abstract class IGenericRepository<T> {
  abstract getAll(): Promise<T[]>;

  abstract get(id: string): Promise<T>;

  abstract create(item: T): Promise<T>;

  abstract update(id: string, item: T);
}

And so on..

Contacts
Email: luizcalaca@gmail.com
Instagram: https://www.instagram.com/luizcalaca
Linkedin: https://www.linkedin.com/in/luizcalaca/
Twitter: https://twitter.com/luizcalaca


This content originally appeared on DEV Community and was authored by Luiz Calaça


Print Share Comment Cite Upload Translate Updates
APA

Luiz Calaça | Sciencx (2022-02-13T01:03:57+00:00) Is just typing the difference between Typescript and Javascript?. Retrieved from https://www.scien.cx/2022/02/13/is-just-typing-the-difference-between-typescript-and-javascript/

MLA
" » Is just typing the difference between Typescript and Javascript?." Luiz Calaça | Sciencx - Sunday February 13, 2022, https://www.scien.cx/2022/02/13/is-just-typing-the-difference-between-typescript-and-javascript/
HARVARD
Luiz Calaça | Sciencx Sunday February 13, 2022 » Is just typing the difference between Typescript and Javascript?., viewed ,<https://www.scien.cx/2022/02/13/is-just-typing-the-difference-between-typescript-and-javascript/>
VANCOUVER
Luiz Calaça | Sciencx - » Is just typing the difference between Typescript and Javascript?. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2022/02/13/is-just-typing-the-difference-between-typescript-and-javascript/
CHICAGO
" » Is just typing the difference between Typescript and Javascript?." Luiz Calaça | Sciencx - Accessed . https://www.scien.cx/2022/02/13/is-just-typing-the-difference-between-typescript-and-javascript/
IEEE
" » Is just typing the difference between Typescript and Javascript?." Luiz Calaça | Sciencx [Online]. Available: https://www.scien.cx/2022/02/13/is-just-typing-the-difference-between-typescript-and-javascript/. [Accessed: ]
rf:citation
» Is just typing the difference between Typescript and Javascript? | Luiz Calaça | Sciencx | https://www.scien.cx/2022/02/13/is-just-typing-the-difference-between-typescript-and-javascript/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.