Argument of type ‘HttpStatus’ is not assignable to parameter of type ‘(resolve: (value?: {} | Thenable) => void, reject: (reason?: any) => void) => any’. Type ‘HttpStatus’ provides no match for the signature ‘(resolve: (value?: {} | Thenable) => void, reject: (reason?: any) => void): any’.


Two way to resolved this problem: Change index.d.ts function resolve<T>(value?: T | Thenable<T>): Promise<T>; This is a bad type definition. It makes the claim that for any type T, you can call the function with 0 arguments, and get a promise that resolves to T. Which is: generally not what one intends by calling Promise.resolve() … Continue reading Argument of type ‘HttpStatus’ is not assignable to parameter of type ‘(resolve: (value?: {} | Thenable) => void, reject: (reason?: any) => void) => any’. Type ‘HttpStatus’ provides no match for the signature ‘(resolve: (value?: {} | Thenable) => void, reject: (reason?: any) => void): any’.

Async/Await with Promise in Node Express and TypeScript 2


In this tutorial i will try to implement async/await with promise in typescript 2. Step1: First of all we need to config for tsconfig.json Focus on hightligth text "compilerOptions": { "target": "es6", "lib": ["es2015", "es2016", "dom", "es2017", "es6", "es5"], // "lib": ["es6", "dom"], //"outDir": "./**/*", // use this for building out to a differen't directory' … Continue reading Async/Await with Promise in Node Express and TypeScript 2

Istanbul Code coverage – TypeScript with Express on Node js


Needed pacakges: npm install mocha chai istanbul remap-istanbul typescript   Config in package.json : { "name": "express", "version": "0.0.0", "private": true, "scripts": { "start": "node ./dist/www", "build": "tsc -w -p .", "build:ubuntu": "sudo tsc -w -p .", "build:CI": "sudo tsc -p .", "install:global:dependencies": "npm install -g typescript && npm install -g nodemon && npm install … Continue reading Istanbul Code coverage – TypeScript with Express on Node js

Get started with typescript, express and test


At the end of this post, you will have your web app up and running locally in your dev environment. Pre-requisites Before you get started, ensure that you have the following dependencies in place Git Node js NPM Visual Studio Code (or any other editor of your choice) Lets get started Create a new folder … Continue reading Get started with typescript, express and test

Authenticate a Node.js API with JSON Web Tokens


Code #Introduction Authentication is one of the big parts of every application. Security is always something that is changing and evolving. In the past, we have gone over Node authentication using the great Passport npm package. Those articles used the session based authentication however, which has problems when we talk about scaling web services and … Continue reading Authenticate a Node.js API with JSON Web Tokens