Skip to content

julianmelero/TypeScript

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

67 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TypeScript

Basic use of TypeScript

You need:

  • Node
  • NPM

Init project

Before run, install this dependencies

npm i -y

npm i typescript

npm i --save date-fns

npm i -D @types/lodash

npm i -D ts-node

npm i @capacitor/camera

npm install --save-dev @faker-js/ faker

npm i axios

npm i -D class-validator

Or

run in main folder npm install

Compile TS

To compile TS code, you need to use npx tsc or npx tsc --watch in main directory. If you want to run code, move to dist folder and run node 'file name'

Or

Using ts-node

npx ts-node 'file.ts'

What is your level?

BASIC

  1. Hello World
  2. Numbers
  3. Booleans
  4. Strings
  5. Arrays
  6. Any
  7. Union Types
  8. Alias
  9. Null and Undefined
  10. Fuctions
  11. Void functions
  12. Objects in functions
  13. Objects
  14. Import / Export (product folder)
  15. Using TS in compatible lib (date-fns)
  16. Using TS in non compatible Lib (lodash)

INTERMEDIATE

  1. Enums
  2. Tuples
  3. Unknow
  4. Never
  5. Optional Params and Nullish-coalescing
  6. Default
  7. Rest
  8. Overload
  9. Overload II
  10. Interfaces
  11. Create Complex Interfaces (app folder)
    • Inheritance in Interfaces
    • Readonly
    • CRUD
    • Omit and Pick Type
    • Partial and Required
    • Readonly
    • Type param in function
    • Readonly Array

ADVANCED

  1. First Class
  2. Methods
  3. Public
  4. Private
  5. Constructor
  6. Getters
  7. Setters
  8. Inheritance
  9. Protected
  10. Static
  11. Interfaces
  12. Abstract
  13. Singleton (SOLID)
  14. Promises
  15. App (Type HTTP Response)
    • Functions to classes
    • Main 2. Product Memory
    • Connect to Web API
    • Main 3. CRUD from API
  16. Generics
    • Generics Class
    • Generic Methods
  17. Decorators

What are DTOs?

When you shouldn't send id or other param like created at, we can omit this, for example, in mongodb or in RDB. We have this:

{ "id": '045fdssdf44sdfsdf279', "title": 'My product', "price": 50, "createdAt": "2022-08-03T16:20:53" }

In that non relatinal DB's, we not send id, or in RDB not send created at, so we send:

{ "id": '045fdssdf44sdfsdf279', "title": 'My product', "price": 50 }

In this example we omit this params, but we recivied all params from the backend. This data is called DTO.

About

How to use TypeScript

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published