如何学习ts?lib.es5.d.ts
- ts改java的设计模式
前端工种:
- 原生、vue2、vue3、react
- node
- pm2启动cli ts-node
- gulp编译
- web
新名词:
swc
esbuild
v8-compile-cahche + sparking
数据库连接池
SOLID
// 产品类class Product {deliver () {console.log('运输')}}class Truck extends Product {deliver () {console.log('陆运')}}class Ship extends Product {deliver () {console.log('海运')}}// 工厂类class SimpleFactory {create (type) {if (type == 'truck') {return new Truck();} else if (type == 'ship') {return new Ship();}}}let t = new SimpleFactory();t.create('truck').deliver();let s = new SimpleFactory();s.create('ship').deliver();// 陆运// 海运
控制翻转 IoC
var factory = {};factory.car = function () {console.log('car');}factory.plane = function () {console.log('plane');}factory.manage = function (create) {return new factory[create]();}let car = factory.manage('car');let plane = factory.manage('plane');// car// plane
系统约束 command键快速跳入
var a = Symbol('Jack');console.log(a.description);// Property 'description' does not exist on type 'symbol'// compiler option to 'es2019' or laterconsole.log(a.toString()); // Symbol(Jack)function showWarning(msg: string, mode: typeof a) {console.log(mode.description);}
const textEl = document.querySelector('input');// console.log(textEl.value); // Object is possibly 'null'// 常规方式, 先判断,if (textEl != null) {textEl.addEventListener('click', e => {console.log(e.clientX);})console.log(textEl.value);}// 屏蔽nullconst text2 = <HTMLInputElement>document.querySelector('input');console.log(text2.value);
