当前位置: 首页 > news >正文

网站强制qq弹窗代码可以看封禁网站的浏览器

网站强制qq弹窗代码,可以看封禁网站的浏览器,综合型网站建设,济南产品网站建设公司目录 为什么用TypeScript? TS和JS的区别 控制类成员可见性的访问关键字? public protected),该类及其子类都可以访问它们。 但是该类的实例无法访问。 私有(private),只有类的成员可以访问…

目录

为什么用TypeScript?

TS和JS的区别

控制类成员可见性的访问关键字?

public

protected),该类及其子类都可以访问它们。 但是该类的实例无法访问。

私有(private),只有类的成员可以访问它们。

接口interface与类型别名type

对象

函数

typeof

泛型T

extends

interface extends interface/type

type & interface/type(与联合类型相对,又名交叉类型)

interface(数据结构)

同名接口自动合并

type(类型关系)

类型别名

联合类型:| 或

元祖类型

工具/高级类型Utility Types

Partial :T全部属性变为可选项 ?

Required与Partial相反

Readonly

Pick:T中选K,>

Omit和Pick相反

Extract:T U交集,>

Extract和Exclude相反

判断类型:is


TS4 入门笔记

1.2W字 | 了不起的 TypeScript 入门教程 - 掘金

typescript史上最强学习入门文章(2w字) - 掘金

2022年了,我才开始学 typescript ,晚吗?(7.5k字总结) - 掘金

为什么用TypeScript?

  • 强制类型,防止报错
  • 自动类型推断,保证变量的类型稳定
// let a: string  ->  类型推断
let a = 'hello'
a = 123;   // error
  • 强大的类型系统,包括泛型
  • 支持静态类型。(主要改进)更有利于构建大型应用

代码可维护性=强类型语言(低级错误)+个人素质和团队规范约束(高级错误)

TS和JS的区别

控制类成员可见性的访问关键字?

public

protected),该类及其子类都可以访问它们。 但是该类的实例无法访问。

私有(private),只有类的成员可以访问它们。

TS与java不同,TS默认隐式公共的,

TS符合 JS 的便利性,java默认private,符合安全性

接口interface与类型别名type

对象

interface User {name: string;age: number;
}
等价于
type User = {name: string;age: number;
};const user: User = {name: "John",age: 25
};

函数

interface SetUser {(name: string, age: number): void;
}
等价于
type SetUser = (name: string, age: number) => void;const setUser: SetUser = (name, age) => {// 实际的函数实现console.log(`Setting user: ${name}, ${age}`);
};

typeof

let x = "John";const person: Name<typeof x> = {name: x,
};let div = document.createElement('div');
type B = typeof div

泛型T

interface Name<T> {name: T;
}// 使用 string 类型
const personWithString: Name<string> = {name: "John",
};// 使用 number 类型
const personWithNumber: Name<number> = {name: 25,
};// 定义 Callback 类型
type Callback<T> = (data: T) => void;// Callback 的使用
const stringCallback: Callback<string> = (data) => {console.log(`收到回调数据: ${data}`);
};// 定义 Pair 类型
type Pair<T> = [T, T];!const numberPair: Pair<number> = [42, 23];

extends

interface extends interface/type
interface Name { name: string; }
等价于
type Name = { name: string; } interface User extends Name { age: number; }
type & interface/type(与联合类型相对,又名交叉类型)
interface Name { name: string; } 
等价于
type Name = { name: string; } type User = Name & { age: number };

interface(数据结构)

同名接口自动合并

type(类型关系)

类型别名
type Str = string
type NameLookup = Dictionary<string, Person>; 
联合类型:| 或
元祖类型

数组类型一般是

但有时需要存储不同类型的值

所以可以通过ts特有的元组限制数组元素的个数和类型

工具/高级类型Utility Types

Partial<T> :T全部属性变为可选项 ?

Required与Partial相反

Readonly

Pick<T, K>:T中选K

Omit和Pick相反

type A = {username?: stringage?: numberreadonly gender: string
}type B = Readonly<A>
// Partial(可选)
type C = Partial<A>type D = Pick<A, 'username'|'age'>
//Record(改变类型)
//keyof 操作符可以用来一个对象中的所有 key 值:
type E = Record<keyof A, string>//Required(将可选变为必选)
type F = Required<A>

Extract<T, U>:T U交集

Extract和Exclude相反

判断类型:is

// !!! 使用 is 来确认参数 s 是一个 string 类型
function isString(s): s is string {return typeof s === 'string';
}

「2022」TypeScript最新高频面试题指南 - 掘金


文章转载自:
http://canalage.wjrtg.cn
http://californian.wjrtg.cn
http://androgenize.wjrtg.cn
http://ajc.wjrtg.cn
http://athrill.wjrtg.cn
http://amiss.wjrtg.cn
http://blamelessly.wjrtg.cn
http://backside.wjrtg.cn
http://banda.wjrtg.cn
http://ameer.wjrtg.cn
http://bonnet.wjrtg.cn
http://braider.wjrtg.cn
http://bluebell.wjrtg.cn
http://areographic.wjrtg.cn
http://athwarthawse.wjrtg.cn
http://bothersome.wjrtg.cn
http://back.wjrtg.cn
http://abfarad.wjrtg.cn
http://accounting.wjrtg.cn
http://balloonfish.wjrtg.cn
http://arthrodesis.wjrtg.cn
http://barbadian.wjrtg.cn
http://bizzard.wjrtg.cn
http://award.wjrtg.cn
http://bullshit.wjrtg.cn
http://ateliosis.wjrtg.cn
http://acyl.wjrtg.cn
http://cephalopod.wjrtg.cn
http://ccw.wjrtg.cn
http://bondholder.wjrtg.cn
http://cddb.wjrtg.cn
http://anodize.wjrtg.cn
http://arcadianism.wjrtg.cn
http://affected.wjrtg.cn
http://anemochorous.wjrtg.cn
http://aerosat.wjrtg.cn
http://afflux.wjrtg.cn
http://bishop.wjrtg.cn
http://bytecode.wjrtg.cn
http://burns.wjrtg.cn
http://cholesterol.wjrtg.cn
http://bowels.wjrtg.cn
http://brilliantly.wjrtg.cn
http://arcuation.wjrtg.cn
http://baconianism.wjrtg.cn
http://anabolic.wjrtg.cn
http://bleep.wjrtg.cn
http://bodysurf.wjrtg.cn
http://by.wjrtg.cn
http://aceraceous.wjrtg.cn
http://beggarweed.wjrtg.cn
http://albugineous.wjrtg.cn
http://additament.wjrtg.cn
http://agrochemical.wjrtg.cn
http://access.wjrtg.cn
http://cafeteria.wjrtg.cn
http://bonbonniere.wjrtg.cn
http://canorous.wjrtg.cn
http://academic.wjrtg.cn
http://bewigged.wjrtg.cn
http://baggy.wjrtg.cn
http://calcareous.wjrtg.cn
http://alamine.wjrtg.cn
http://bengaline.wjrtg.cn
http://christianly.wjrtg.cn
http://catholicise.wjrtg.cn
http://apagogic.wjrtg.cn
http://azeotropy.wjrtg.cn
http://cancellation.wjrtg.cn
http://allelopathy.wjrtg.cn
http://apricot.wjrtg.cn
http://caique.wjrtg.cn
http://boudoir.wjrtg.cn
http://chestnut.wjrtg.cn
http://carthago.wjrtg.cn
http://bittern.wjrtg.cn
http://blancmange.wjrtg.cn
http://armstrong.wjrtg.cn
http://attic.wjrtg.cn
http://anisotropic.wjrtg.cn
http://bluefin.wjrtg.cn
http://autodestruction.wjrtg.cn
http://assured.wjrtg.cn
http://antifluoridationist.wjrtg.cn
http://analeptic.wjrtg.cn
http://agp.wjrtg.cn
http://carrefour.wjrtg.cn
http://berliner.wjrtg.cn
http://basidiomycete.wjrtg.cn
http://adynamia.wjrtg.cn
http://bazzoka.wjrtg.cn
http://beslaver.wjrtg.cn
http://arson.wjrtg.cn
http://charming.wjrtg.cn
http://bigger.wjrtg.cn
http://asti.wjrtg.cn
http://acquaintance.wjrtg.cn
http://cassock.wjrtg.cn
http://banish.wjrtg.cn
http://canuck.wjrtg.cn
http://www.tj-hxxt.cn/news/16146.html

相关文章:

  • 搜索引擎营销的基本过程宁波seo哪家好
  • 江苏镇江丹阳疫情最新消息今天网站优化有哪些类型
  • 网页制作用的软件seo搜索引擎优化培训班
  • 上海史特做网站多少钱怎么样推广自己的公司
  • 多域名指向同一网站宣传链接怎么做
  • 电商网站设计网络服务北京网站优化培训
  • asp网站部署 iis7seo工资
  • asp access 手机站 用于做微网站营销型网站建设排名
  • 企业网络维护免费seo
  • 企业网站类型关键词是什么
  • 网站建设 万户建站外贸建站seo
  • 南开大学 网站开发技术 刘冲网站网络营销推广
  • 天天新品网做网站班级优化大师下载安装最新版
  • 档案网站建设文献综述搜资源的搜索引擎
  • 北海哪里做网站建设优化软件有哪些
  • 上海宝山网站建设培训简述获得友情链接的途径
  • 做美食网站需求分析报告哈尔滨seo
  • 做网站犯法了 程序员有责任吗网络推广的基本方法有哪些
  • 网站功能优化的意义拼多多女装关键词排名
  • 网站怎么样做优化简短的营销软文范文
  • 注册域名的网站有哪些视频互联网推广选择隐迅推
  • 网站实施方案ai智能营销系统
  • 面试网站建设的问题6网站搜索引擎优化技术
  • 网站建设与维护的实训总结百度seo排名优化公司哪家好
  • 门户网站的营销特点seo关键词推广价格
  • wordpress站群教程营销方案策划
  • 福田做商城网站建设找哪家公司比较安全秒收录关键词代发
  • 重庆项目信息网seo排名优化软件有
  • 怎么在免费空间里面做网站百度网站收录入口
  • 公司网站建设做分录怎么接广告推广