To Compile Typescript project Method 1 : 1. Create a tsconfig.json file into source folder 2. Add the compiler options in tsconfig file like sourcemap:true,
Category: Typescript
Mongoose and TypeScript
Strongly typed models with Mongoose and TypeScript Mongoose provides a layer of abstraction over MongoDB that makes validation, casting & business logic boilerplate more enjoyable.
Typescript 1 – Type Annotation & Interface
I. TypeScript – Type Annotations Similarly, we can declare an object with inline annotations for each of the properties of the object. var employee :
Creating and using Generics in Typescript
Creating and using Generics in Typescript Github 1. Understanding and Applying Built-in Generics 2. Generic Functions 3. Generic Interfaces and Classes What are Generics ?
TypeScript for JavaScript Programmers – II
Typescriptlang.org https://www.typescriptlang.org/docs/handbook/generics.html Interfaces : One of TypeScript’s core principles is that type checking focuses on the shape that values have. This is sometimes called “duck
TypeScript for JavaScript Programmers – I
Typescriptlang.org function greeter(person: string) { return “Hello, ” + person; } let user = “Jane User”; document.body.textContent = greeter(user); Interfaces : interface Person { firstName:
Typescript – Configuring, Compiling and Debugging
Configuring, Compiling, and Debugging TypeScript Projects Why TypeScript ? 1. Compile-time type checking prevents errors 2. Classes, types and interfaces assist in collaborative development 3.
Typescript 3 – Interface & Generic
Interface interface IsPerson { name : string; age: number; speak(a: string): void; spend(a: number): number; } const me: IsPerson = { name: ‘shaun’, age: 30,
Typescript 2 – Interface & Classes
1.tsconfig.json { “compilerOptions”: { “target”: “es6”, /* Specify ECMAScript target version: ‘ES3’ (default), ‘ES5’, ‘ES2015’, ‘ES2016’, ‘ES2017’, ‘ES2018’, ‘ES2019’, ‘ES2020’, or ‘ESNEXT’. */ “module”: “es2015”,
Create Form Using Class – React Form
TypeScript Form preventDefault on Submit <div id=”app”></div> class LoginPanel { public appDiv: HTMLElement = document.getElementById(‘app’); constructor() { this.setForm(); const form = document.getElementById(‘loginForm’); form.addEventListener(‘submit’, (event) =>