From 4af823a0a4a193236b8f75efc21f2753c27fbc57 Mon Sep 17 00:00:00 2001 From: zhongsp Date: Wed, 18 Nov 2015 20:39:06 +0800 Subject: [PATCH] Format Gitbook --- book.json | 3 ++- doc/handbook/SUMMARY.md | 2 ++ preface.md | 44 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 preface.md diff --git a/book.json b/book.json index 6e98fe6..73f64cf 100644 --- a/book.json +++ b/book.json @@ -2,6 +2,7 @@ "gitbook": ">2.0.0", "title": "TypeScript Handbook", "structure": { - "summary": "./doc/handbook/SUMMARY.md" + "summary": "./doc/handbook/SUMMARY.md", + "readme": "preface.md" } } \ No newline at end of file diff --git a/doc/handbook/SUMMARY.md b/doc/handbook/SUMMARY.md index 685a5ab..51115ea 100644 --- a/doc/handbook/SUMMARY.md +++ b/doc/handbook/SUMMARY.md @@ -1,3 +1,5 @@ +# Summary + * [基础类型](./doc/handbook/Basic Types.md) * [接口](./doc/handbook/Interfaces.md) * [类](./doc/handbook/Classes.md) diff --git a/preface.md b/preface.md new file mode 100644 index 0000000..010ca6e --- /dev/null +++ b/preface.md @@ -0,0 +1,44 @@ +# TypeScript Handbook(中文版) + +TypeScript让你以你想要的方式写JavaScript。 +TypeScript是具有类型的JavaScript的超集并可以编译成普通的JavaScript代码。 +支持任意浏览器,任意环境,任意系统并且开源。 + +TypeScript是Microsoft公司注册商标。 + +## TypeScript语言规范 + +Read [TypeScript Language Specification](https://github.com/Microsoft/TypeScript/blob/master/doc/spec.md) + +## 使用Gulp和TypeScript + +安装 `gulp` 和 `gulp-typescript`. 查看 [package.json](./package.json). + +```sh +$ npm install --global gulp +$ npm install --save-dev gulp gulp-typescript +``` + +配置 gulp. 查看 [gulpfile.js](./gulpfile.js). + +```js +gulp.task('typescript', function() { + var tsResult = gulp.src('ts/*.ts') + .pipe(ts({ + target: 'ES5', + declarationFiles: false, + noExternalResolve: true + })); + + tsResult.dts.pipe(gulp.dest('dist/tsdefinitions')); + + return tsResult.js.pipe(gulp.dest('dist/typescript')); +}); +``` + +## 手册之外的主题 + +* [tsconfig.json](https://github.com/zhongsp/TypeScript/tree/master/doc/doc/tsconfig.json.md) (TypeScript 1.5) +* [let和const](https://github.com/zhongsp/TypeScript/tree/master/doc/doc/let_and_const.md) (TypeScript 1.4) +* [元组类型 - Tuple Types](https://github.com/zhongsp/TypeScript/tree/master/doc/doc/tuple_types.md) (TypeScript 1.3) +* [受保护的成员 - Protected members](https://github.com/zhongsp/TypeScript/tree/master/doc/doc/protected.md) (TypeScript 1.3)