[TypeScript] Configuring a New TypeScript Project

This lesson walks you through creating your first .tsconfig configuration file which will tell the TypeScript compiler how to treat your .ts files.

Init a config.json file:

tsc --init

tsconfig.json, will be created:

{
    "compilerOptions": {
        "module": "commonjs",
        "target": "es5",
        "noImplicitAny": false,
        "sourceMap": false
    },
    "exclude": [
        "node_modules"
    ]
}

Previously, we nee to say:

tsc app.ts

to compile file, now, we don‘t need to do that, it will find ts files and compile when you run ‘tsc‘. notice, node_modules is excluded by default.

时间: 2024-08-14 02:24:29

[TypeScript] Configuring a New TypeScript Project的相关文章

转载:TypeScript 简介与《TypeScript 中文入门教程》

简介 TypeScript是一种由微软开发的自由和开源的编程语言.它是JavaScript的一个超集,而且本质上向这个语言添加了可选的静态类型和基于类的面向对象编程.安德斯·海尔斯伯格,C#的首席架构师,已工作于TypeScript的开发. TypeScript扩展了 JavaScript 的句法,所以任何现有的JavaScript程序可以不加改变的在TypeScript下工作.TypeScript是为大型应用之开发而设计,而编译时它产生 JavaScript 以确保兼容性. TypeScrip

[TypeScript] Installing TypeScript and Running the TypeScript Compiler (tsc)

This lesson shows you how to install TypeScript and run the TypeScript compiler against a .ts file from the command line. install: npm install -g typescript tsc -v // version app.ts: class Person{} RUN: tsc app.ts You will see the js file with the sa

[TypeScript] JSON对象转TypeScript对象范例

[TypeScript] JSON对象转TypeScript对象范例 Playground http://tinyurl.com/nv4x9ak Samples class DataTable { public columns: Array<string>; public rows: Array<DataRow>; } class DataRow { public cells: Array<string>; } class Test { public jsonObjec

TypeScript入门五:TypeScript的接口

TypeScript接口的基本使用 TypeScript函数类型接口 TypeScript可索引类型接口 TypeScript类类型接口 TypeScript接口与继承 一.TypeScript接口的基本使用 1.1定义TypeScript接口的指令(interface) 接口让我们想到的第一个短语就是(API).比如日常我们所说的调用某某程序的API一般都是跨应用的接口,如别的网站的或者APP的接口:还有我们每天都是用的编程语言的指令和内置的方法及属性,这些可以叫做编程语言的接口:还有令我们既

TypeScript入门三:TypeScript函数类型

TypeScript函数类型 TypeScript函数的参数 TypeScript函数的this与箭头函数 TypeScript函数重载 一.TypeScript函数类型 在上一篇博客中已经对声明TypeScript类型变量已经做了初步的解析,这里先回顾以下: 1 //声明函数 2 function add1(x:number,y:number):number{ 3 return x+y; 4 } 5 6 let add2 = function(x:number,y:number):number

TypeScript入门七:TypeScript的枚举

关于枚举 数字枚举 字符串枚举 异构枚举 计算的和常量成员 运行时的枚举与反向映射 常量枚举与外部枚举 一.关于枚举 枚举:一个集的枚举是列出某些有穷序列集的所有成员的程序,或者是一种特定类型对象的计数. 在定义中可以看到这些关键词:有穷序列集.成员.类型对象.计数. 在这些关键字中可以了解到枚举是一组有穷数据的集合:这些数据或者类型对象被当成这个集合的成员:计数的话我的理解有两种:前面提到有序集那么就可以使用有序的数字对数据进行标识,而前面提到的有穷就说明这些数据量是可以被计算的. 根据这些定

Use Typescript in asp.net MVC project.

1. create an empty web project. 2. add a index.html file. 3. open nuget browser, and enter tag:typescript. choose jquery.typescript.definitelytyped and install it. 4. then in project folder/ scripts/typings/jquery/jquery.d.ts file will appear. 5. dra

[TypeScript] Configuring TypeScript Which Files to Compile with &quot;Files&quot; and &quot;OutDir&quot;

This lesson shows how to configure the .tsconfig so you only compile the .ts files you want. It then shows how to configure which directory you'd like to compile the files to using "outDir". tsconfig.json: { "compilerOptions": { "

[TypeScript] Using Lodash in TypeScript with Typings and SystemJS

One of the most confusing parts of getting started with TypeScript is figuring out how to use all the libraries that you know and love from JavaScript. This lesson walks you through including Lodash in your project, installing Lodash definition files