2018 TypeScript Update(3)Introduction Basic Grammar
Iterators and Generators
http://www.typescriptlang.org/docs/handbook/iterators-and-generators.html
for .. of .. Statements
let someArray = [1, “string”, false];
for ( let entry of someArray){
console.log(entry);
}
for..of VS. for..in Statements
for in returns a list of keys on the object
for of returns a list of values of the object
let list = [4, 5, 6];
for (let i in list) {
console.log(i); // 0, 1, 2
}
for (let i of list) {
console.log(i); // 4, 5, 6
}
Modules and Namespaces
http://www.typescriptlang.org/docs/handbook/modules.html
“Internal modules” are now “namespaces”.
“External modules” are now simply “modules”.
Modules are executed within their own scope, not in the global scope, all variables, functions, classes, etc declared in a module are not visible outside the module unless they are saying export.
CommonJS module loader for Node.js and require.js for Web Application.
Exporting a declaration
export interface StringValidator {}
export const numberRegexp = /^[0-9]+$/;
export statements
class ZipCodeValidator implements StringValidator {}
export {ZipCodeValidator};
export {ZipCodeValidator as mainValidator};
export { ZipCodeValidator as RegExpBasedZipCodeValidator } from “./ZipCodeValidator”;
Import
import { ZipCodeValidator } from “./ZipCodeValidator”;
import { ZipCodeValidator as ZCV } from “./ZipCodeValidator”;
import * as validator from “./ZipCodeValidator”;
let myValidator = new validator.ZipCodeValidator();
Default exports
declare let $: jQuery;
export default $;
import $ from “JQuery”;
Simple Example for Module
For Node.js, use - - module commonjs; for require.js use - - module amd
> tsc --module commonjs Test.ts
Module usually will be *.d.ts
Namespaces
http://www.typescriptlang.org/docs/handbook/namespaces.html
namespace Validation {
export interface StringValidator {}
}
let validator = new Validation.ZipCodeValidator();
Merge and Compile file together
> tsc --outFile sample.js Validation.ts LettersOnlyValidator.ts ZipCodeValidator.ts Test.ts
http://www.typescriptlang.org/docs/handbook/jsx.html
JSX
Directly put XML in codes, it will be convert to javascript.
interface PropsType {
children: JSX.Element
name: string
}
class Component extends React.Component<PropsType, {}> {
render() {
return (
<h2>
this.props.children
</h2>
)
}
}
<Component>
<h1>Hello</h1>
</Componet>
Decorators
http://www.typescriptlang.org/docs/handbook/decorators.html
ECMAScript VS JavaScript
Browser support for ES6
http://kangax.github.io/compat-table/es6/
Mixins
http://www.typescriptlang.org/docs/handbook/mixins.html
Project Configuration
http://www.typescriptlang.org/docs/handbook/tsconfig-json.html
Build Tools
http://www.typescriptlang.org/docs/handbook/integrating-with-build-tools.html
Grunt, Gulp, Webpack
References:
http://sillycat.iteye.com/blog/2412076
http://sillycat.iteye.com/blog/2412265
vue and typescript
http://www.open-open.com/lib/view/open1519898735170.html
https://segmentfault.com/a/1190000011864013
https://segmentfault.com/a/1190000011744210#articleHeader12
https://github.com/shenzekun/vue-qq-music
Generic
http://www.open-open.com/lib/view/open1519652853300.html
ES6
http://es6.ruanyifeng.com/#docs/intro
分享到:
相关推荐
学习型脚本简介我使用此存储库学习TypeScript基础知识如果要查看HelloWorld / *的工作方式,请使用cmd命令: tsc classes.ts节点classes.js 或者tsc use-utils.ts utils / utils.ts -out use-utils-combined.js 如果...
主要用typescript写的3D数学库。内容包含矩阵,向量,四元数,射线查询等。直接拖到工程里面即刻使用。
Learning TypeScript 英文azw3 本资源转载自网络,如有侵权,请联系上传者或csdn删除 本资源转载自网络,如有侵权,请联系上传者或csdn删除
2021年3月,TypeScript发布了自己的最新版本手册。该手册是学习 TypeScript 语言及其常用用法的主要资源。官方人员指出,新手册在 TypeScript 团队中已经是一个运行多年的项目,包含了大大小小的数百个贡献。 这项...
Pro TypeScript. Application-Scale JavaScript Development Steve Fenton page 300 TypeScript is a language created and maintained by Microsoft, and released under an open-source Apache 2.0 License (2004...
一套基于vue3、element-plus、typescript4、vite3的后台集成方案;使用了最新的vue3,vite4,TypeScript等主流技术开发,开箱即用的中后台前端解决方案,可以用来作为项目的启动模版,vue-element-plus-admin 的定位...
Vue3 + TypeScript + Uniapp 开发小程序【医疗小程序完整案例·一篇文章精通系列】Vue3 + TypeScript + Uniapp 开发小程序【医疗小程序完整案例·一篇文章精通系列】Vue3 + TypeScript + Uniapp 开发小程序【医疗小...
Vue3+TypeScript实战项目,使用 ElementUI 搭建页面,完成登录、商品列表、用户列表、角色列表、退出登录。通过页面展示、搜索、分页、编辑等功能的实现练习怎么在vue3中使用TypeScript。...
3)重启Eclipse之后会Window-->>Preferences出现菜单 typescript 说明你安装成功啦!恭喜你安装成功 4)打开菜单Window-->>Preferences-->>typescript 出现TypeScript表示成功 5、下载Nodejs 1)...
TypeScript快速上手教程TypeScript快速上手教程TypeScript快速上手教程TypeScript快速上手教程TypeScript快速上手教程TypeScript快速上手教程
开始一个新的React + Typescript应用程序npm init npm i-保存react-react-dom npm i -D打字稿npm i -D @ types / react @ types / react-dom @ types / node npm i -D webpack webpack-cli npm i -D ts-loader 设置...
Pro TypeScript 2nd.2018.pdf, 英文版。
通过Vue3+TypeScript实现的日历组件,组件有显示阳历,阴历,星座,假期等等功能;
TypeScript.3.0.Quick.Start.Guide 最新2018年8月新书3.0TypeScript.
Advanced TypeScript Programming Projects: Build 9 different apps with TypeScript 3 and JavaScript frameworks such as Angular, React, and Vue Gain in-depth knowledge of TypeScript and the latest ...
vue3-element-admin 是【有来开源组织】基于 Vue3 + Vite4 + TypeScript + Element-Plus + Pinia 等前端主流技术栈从0到1搭建后台管理系统模板(前后端开源)。 后端是基于 Spring Boot 3.0 、Spring Security 6.0 ...
typescript
《TypeScript》电子pdf版 typeScript基础学习文档
2021=2022年,Coderwhy新Vue3与Typescript课程资源_ppt_文档_源码