JavaScript过去一直被当作一种玩具语言存在,直到2005年以后,这门语言又开始活跃并可以说是火爆,而且随着浏览器版本的不断升级和完善,各种DOM之间的兼容性已经渐渐的被各种技术解决了,比如经典的jQuery,JavaScript版本也在快速发展和完善.现如今,Web世界越来越让人摸不着边际,JSON.AJAX.HTML5.Sliverlight.Node.js.PhoneGap几乎都可以见到JavaScript忙碌的身影.不过渐渐的有经验的用户会发现JavaScript语言本身的局限性导…
我的electron教程系列 electron教程(一): electron的安装和项目的创建 electron教程(番外篇一): 开发环境及插件, VSCode调试, ESLint + Google JavaScript Style Guide代码规范 electron教程(番外篇二): 使用TypeScript版本的electron, VSCode调试TypeScript, TS版本的ESLint electron教程(二): http服务器, ws服务器, 子进程管理 electron教程…
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…
To fix Promise is not recolized in TypeScript, we can choose to use a lib: npm i @types/es6-promise we can also use built-in libs: { "compilerOptions": { "module": "commonjs", "target": "es5", "noImpl…
The TypeScript compiler is a powerful tool which catches mistakes even in vanilla JavaScript. Try it online at the TypeScript Playground, zero setup required. Error version: var movie = { title: "Memento", year: 2000, IMDB: 8.5, title: "&qu…
The DOM can be a bit tricky when it comes to typing. You never really know exactly what you're going to get, so you have to educate your codebase into what you know you're using. This is done using Type Assertion where TypeScript types know they're a…
It can be painful to write the same function repeatedly with different types. Typescript generics allow us to write 1 function and maintain whatever type(s) our function is given. This lesson covers syntax and a basic use case for Typescript generics…
Decorators are a powerful feature of TypeScript that allow for efficient and readable abstractions when used correctly. In this lesson we will look at how we can use decorators to initialize properties of a class to promises that will make GET reques…
1.TypeScript完全解读-开发环境搭建 初始化项目 手动创建文件夹 D:\MyDemos\tsDemo\client-demo 用VSCode打开 npm init:初始化项目 然后我们的项目根目录就多了个package.json的文件 创建相关目录文件夹 untils:业务相关的,可服用的方法 assets:主要放静态资源 img:图片 font:字体文件 tools:业务无关的纯工具的函数 api:把一些可以复用的接口请求的方法,放在api文件夹下 config:一般放配置文件,把一…
2.TypeScript完全解读-基础类型 src下新建example文件夹并新建文件.basic-type.ts.截图中单词拼错了.后需注意一下是basic-type.ts 可以装tslint的插件,配合tslint可以做到很好的代码提示 boolean类型 boolean表示布尔类型 这里我们用let声明了一个变量bool的类型是boolean布尔类型的.可以先给他赋值, 第二行是先声明后赋值的形式 上面声明了bool为布尔类型的,后面再赋值123的话就会报错 有提示的错误 123是数字自变…