Skip to content

royderks/typescript-workshop

Repository files navigation

Ex 1a - Everyday types

Go to the TypeScript playground here. Can you fix the errors?

Ex 1b - Everyday types

Go to the TypeScript playground here. Can you fix the errors?

Ex 1c - Everyday types

Go to the TypeScript playground here. Can you fix the errors?

2

Objects vs interfaces

https://www.typescriptlang.org/play?&q=491#code/C4TwDgpgBAglC8UDeBYAUFKBnA9gWwmAAsBLAOwHMAubYAJ3IvQF911RIoAhBZdTAGYkIAGwAmNMgFc8AIwh0WUAGRQAwmzQdoALV6oMUIaIlRpchUtUxN6csAUCAhgGNoavodwFijGlnpGFk17R1doABEoCAAPBzIxLHVPQWFxSRl5RTRWNE0XHDIAqDwQAHlZACsIF2AaKMQDTG9CUkoaAHIBHBwOgBp+IzTTAFYWIA

Ex 2a - Types & Interfaces

Go to the TypeScript playground here. Can you fix the errors?

Ex 2b - Types & Interfaces

Go to the TypeScript playground here. Can you fix the errors?

Ex 2c - Types & Interfaces

Go to the TypeScript playground here. Can you fix the errors?

Ex 3a - Generics

Go to the TypeScript playground here. Can you fix the errors?

Ex 3b - Enums

Go to the TypeScript playground here. Can you fix the errors?

Ex 3c - Generics and Enums

Go to the TypeScript playground here. Can you fix the errors?

Ex 4

  • Install TypeScript
npm i typescript --save-dev
  • Initialize new TypeScript Project
npx tsc --init
  • Rename index.js to index.ts and compile the code:
npx tsc

You can also enable watch mode by running npx tsc -w

  • Add the compile step to the npm scripts

  • Fix the errors in the terminal, so the code will compile.

Ex 5

  • Add the correct types to the index.ts file. What types need to be added? Can you make use of interfaces, or combine types?

  • Combine the requests to these endpoints so'll get one function that combines the order and customer data in one object. (hint: there's an id for customer inside the order request).

Ex 6 - Reduce

https://www.typescriptlang.org/play?&q=107#code/C4TwDgpgBAChD2YA20C8UDeBYAUFKAdgIYC2EAXFAM7ABOAlgQOYA0u+RTFhAriQEYRauAL65cAY3gEaUSIhSU4CiAG0AulHSr2mQqW4ByAIJJ6EiIZZRO3AEwBGKCLZ49xMpUMBZIgA8rGy5KOwAGZ1d8DH1PKEMAKSICS2tbEPCxHHUAbnEcADMeAglgemkoJlp4HjAAIRAACnh+ACsIEuNaWiIQJQRkNXVrMCrIWlBKGgZmAEpMXVoIYB5aAihmto6unoA6RYATHgsGwuLS8oaiCQlyaw257Dd8FGAoAGsIEC111tURxCEoHUunw9HyUAaAEIrhJVB8QOoHiD8DZrnDPpptMCns5kTD0QidmAeFQABZNVozZGLZarVESXQuTAiKk4TKSaRUeAoHZIeBMBqVap1RryAbWQy2QwzGZAA

About

No description, website, or topics provided.

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors