Giter Club home page Giter Club logo

typescript-workshops's Introduction

TypeScript Workshops

Intro

This repository serves as an introduction to TypeScript. After reading through the documentation and completing the challenges, you should have a basic grasp of how the language works.

Setup

VSCode is a great editor for TypeScript. It has great navigation for the language and includes numerous extensions for both JavaScript and Typescript.

Ensure you have npm installed via Homebrew or via Node.

Then install local packages from the root of the project.

npm install

Folders

Basic Types

In the basic-types/ folder, there is some documentation on basic types and data structures. These come from https://www.typescriptlang.org/. Go through each file and experiment with the code.

TSC Playground

TypeScript is compiled into JavaScript for both the browser and Node.js. The tsc-playground/ folder contains an index.ts file that can be compiled into valid JavaScript.

npm run compile-typescript

This command will output an index.js file. You can play around with different compilation flags. See documentation on that here.

Gimme It

Here's a simple Kata to familiarize yourself with the syntax of the language.

Get all tests passing by removing x from xit and running the tests.

npm test gimme-it/

Two Fer

This challenge requires string interpolation and input/return typing for functions.

npm test two-fer/

*Taken from an Exercism challenge

Space Age

This challenge requires more complex typing.

npm test space-age/

*Taken from an Exercism challenge

AWS Lambda

This folder contains some basic set up for a potential AWS Lambda written in TypeScript.

The goal is to create a deployable package for an AWS Lambda for a supported Node.js runtime.

Let's imagine there's an endpoint site.com/users/{user_id}. This is proxied through AWS API Gateway and parsed into an event for AWS Lambda consumption.

The handler can accept the following event:

{
  ...
  "pathParameters": {
    "user_id": "abc123"
  }
}

and return the response:

{
  "statusCode": 200,
  "body": "{\"user\":{\"id\":\"abc123\",\"email\":\"[email protected]\"}}"
}

The following steps are recommended:

  1. Create a test (TDD!)
  2. Pass the test
    1. Hint: npm test aws-lambda/
  3. Resolve all required types
  4. Compile the TypeScript source code
    1. Hint: npx tsc
  5. Zip up the file for AWS
    1. Hint: chmod +x .pack_for_aws/run

typescript-workshops's People

Contributors

jozr avatar rnegash avatar cemreyuksel avatar dependabot[bot] avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.