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

电子商务网站开发的预期目标网站建设费用多少钱

电子商务网站开发的预期目标,网站建设费用多少钱,建设银行代发工资网站,传媒公司运营是干嘛的学习文档#xff1a; TypeScript 之 Class#xff08;上#xff09; (yuque.com) 某个人博客 - 基础类型_TypeScript中文文档 基础类型 - TypeScript 中文手册 TypeScript 基础类型 | 菜鸟教程 (runoob.com) 一、前言 1、ts的作用#xff1a;静态类型检查、非异常失败、… 学习文档 TypeScript 之 Class上 (yuque.com) 某个人博客 -   基础类型_TypeScript中文文档 基础类型 - TypeScript 中文手册 TypeScript 基础类型 | 菜鸟教程 (runoob.com) 一、前言 1、ts的作用静态类型检查、非异常失败、类型工具提供补全和错误信息。 2、tsc: the TypeScript compiler .TypeScript编译器. ts文件不会被直接运行需要通过tsc编译成js文件才能运行。编译命令tsc xxx.ts。通过这个命令 xxx.ts 就会被编译出一个xxx.js 文件出来。 ① 就算编译中类型检查报错了是依旧会编译出结果。想要使用严格模式可以执行命令  tsc --noEmitOnError hello.ts ②如果类型系统可以正确判断出来类型不需要加类型注解。 let msg hello there; // dont need  --  let msg:string 3、编译之后的js会被 类型抹除不再有类型注解降级es6可能被降为-es3 4、严格模式noImplicitAny(当类型被隐士推断为null时报错) 、strictNullChecks(需要明确处理null和undefined) 三、符号专题 0、属性  类型 【类型注解】 1、属性后面加表示属性是可选的  function quicktest(name?:string)【可选属性】 2、多个类型用 | 分割表示该属性可有多个类型 function quicktest(name:string | number) 【联合类型】 3、将一个值用 type name  xxx替代表示用name替代这个值。【类型别名】 type name {firstname:string}   function quicktest(name:name) 4、将一个值用 interface namet  xxx替代.【接口】//除了obj之外类型可以用吗 interface name {firstname:string}    5、类型 as 更具体类型 把类型更具体。【类型断言】 const dom1 document.getElementById(canvas)  as HTMLCanvasElement 6、在某个值后面加 ! 表示明确知道某个值不是null或者undefined时 function quicktest (name: string | null){console.log(name!.toUppercase())} 二、常见类型 - 文档笔记 1、string /number/boolean/array/any 2、变量上的类型注解  let myName:string Alice; 这里类型注解不是必须的因为ts会自动推断 如果你刚开始使用尝试尽可能少的使用类型注解。你也许会惊讶于TypeScript 仅仅需要很少的内容就可以完全理解将要发生的事情。 3、函数 ① 参数类型注解:跟在参数名字后面 function greet(name: string) {console.log(Hello, name.toUpperCase() !!); } ②返回值类型注解:跟在参数列表后面 function getFavoriteNumber(): number {return 26; } ③匿名函数参数通过上下文推断推断出s类型会自动指定类型 4、对象类型 ①列出属性和对应的类型 ②可选属性:在属性后面添加一个? function printName(obj: { first: string; last?: string }) {// ... } 5、联合类型 ①类型用 | 分割? ②使用时需要用代码收窄联合类型。但如果联合类型每个成员都可应用代码则不用收窄。 function printId(id: number | string) {if (typeof id string) {// In this branch, id is of type stringconsole.log(id.toUpperCase());} else {// Here, id is of type numberconsole.log(id);} } 6、类型别名 像赋值变量一样将复杂或简单类型用另一个名字替代 type Point {x: number;y: number; };// Exactly the same as the earlier example function printCoord(pt: Point) {// ... } 7、 接口 命名对象类型的另一种方式 interface Point {x: number;y: number; } function printCoord(pt: Point) { //--- } 类型别名和接口不同接口可易扩展类型别名不可扩展。 // Interface // 通过继承扩展类型 interface Animal {name: string }interface Bear extends Animal {honey: boolean }const bear getBear() bear.name bear.honey// Type // 通过交集扩展类型 type Animal {name: string }type Bear Animal { honey: boolean }const bear getBear(); bear.name; bear.honey;// Interface // 对一个已经存在的接口添加新的字段 interface Window {title: string }interface Window {ts: TypeScriptAPI }const src const a Hello World; window.ts.transpileModule(src, {});// Type // 创建后不能被改变 type Window {title: string }type Window {ts: TypeScriptAPI }// Error: Duplicate identifier Window.8、类型断言 将类型指定为更加具体的类型  const myCanvas document.getElementById(main_canvas) as HTMLCanvasElement;9、字面量类型 除了常见的string/number等类型也可以将类型声明为一个值。常用于函数只能传入一些固定的值时。 function testFunc(name:string,gender:male|female,department:techDepart|manuDepart){//--- } testFunc(小米,female,techDepart) testFunc(小花,female,operDep) //operDep不在可选项 报错①字面量推断 定义的时候给了一个字面量使用的时候这个值来自于一个对象就会报错 declare function handleRequest(url: string, method: GET | POST): void;const req { url: https://example.com, method: GET }; handleRequest(req.url, req.method);// Argument of type string is not assignable to parameter of type GET | POST.因为在使用req.method时它的值GET会被认定为string类型。这和我们第一行声明的字面量GET|POST不同 处理方法 方法一添加类型断言 方法二使用as const将整个对象转为类型字面量。对象被转为类型字面量时默认对象中每一个属性的值都是字面量类型而不是string/number等通用类型。 declare function handleRequest(url: string, method: GET | POST): void;// 方法一添加类型断言 const req { url: https://example.com, method: GET as GET}; // 将对象转为类型字面量 const req { url: https://example.com, method: GET } as const;handleRequest(req.url, req.method); 10、null 或 undefined 11、非空断言 !。明确知道某个值不为null或undefined时,在其后面使用感叹号! function liveDangerously(x?: number | null) {// No errorconsole.log(x!.toFixed()); }
http://www.pierceye.com/news/252584/

相关文章:

  • 学校网站建设流程做网站用哪个工具
  • 网站开发工作室策划案域名的价格
  • 郑州艾特网站建设公司互联网保险图片
  • 网站后台任务网站设计建设一般多少钱
  • 电子商务网站设计的基本流程创业商机网农村
  • 公司网站建设的费用如何入账毕节网站开发公司电话
  • 新浪推网站蜘蛛网站长工作职责
  • 百度网站排名关键词整站优化将wordpress部署
  • 做的ASP网站手机微站和网站数据同步
  • 爱站网长尾关键词挖掘工具营销类型网站怎么建设
  • 泉州seo网站推广在线查企业
  • 东营房地产网站建设wordpress文章关键字替换
  • 网站制作哪里好薇网站建设中最重要的环节是
  • 中山做营销型网站石家庄招投标公共服务平台官网
  • 修改wordpress的站点地址WordPress全屏图
  • 购物网站建设源码wordpress如何更改页脚背景颜色
  • 大型网站开发技术注册网站代码
  • 网站建设管理报告网站建设专家北京注安
  • 免费网站生成软件网站备案中的网站名称
  • 桐庐做网站手机里编辑 Wordpress
  • 外网怎么进入萧山网站优化
  • 做资源下载网站好吗婚恋网站建设公司排名
  • 网站后台管理系统管理员登录wordpress页面模板下载地址
  • 网站用户体验网络科技公司网站制作
  • seo中文全称是什么360搜索怎么做网站自然优化
  • 青岛网站建设技术外包文本资料分享网站 建设
  • 做好网站建设工作wordpress转发微信缩略图
  • 马鞍山网站开发流程设计师免费资源导航
  • 成功的网站不仅仅是优化排视频网站建设应该注意什么
  • 如何制作网站和软件查询关键词密度网站的网址有哪些