包含标签 typescript 的文章

configuration of webstorm for typescript

Create Project Create a new node project. Here is reference of project structure. https://github.com/jan-molak/debugging-typescript-with-webstorm add package.json, tsconfig.json, and src folder. tsconfig.json { "compilerOptions": { "declaration": true, "target": "es6", "module": "commonjs", "moduleResolution": "node", "noImplicitAny": true, "outDir": "./dist", "preserveConstEnums": true, "removeComments": false, "sourceMap": true, "inlineSources": true, "typeRoots" : ["./node_modules/@types"], "lib": [ "es6" ] }, "include": [ "src/**/*", "test/**/*" ], "exclude": [ "node_modules" ] } package.json { "name": "test", "version": "1.0.0", "description": "", "main": ".……

阅读全文

express.js with typescript

express.js with typescript reference: https://github.com/microsoft/TypeScript-Node-Starter First, initialize the project install packages npm install express npm install @types/express --save-dev If you meet a problem, TypeError: (0 , express_1.default) is not a function. add “esModuleInterop”: true to compilerOptions in tsconfig.json TS1259: Module '"F:/test/project/express-ts/node_modules/@types/express/index"' can only be default-imported using the 'esModuleInterop' flag https://stackoverflow.com/a/34520891 import express = require(‘express’) import express from ‘express’; ……

阅读全文