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

海南城乡建设网站网站模板价格

海南城乡建设网站,网站模板价格,自己开公司 自己做网站吗,手机怎做网站目录ts之 命名空间 namespacets之 命名空间 namespacets之 三斜线指令 ( 引入其他.ts文件 )app.tsindex.tsts之 声明文件 d.ts - declare01:declare声明express第三方模块typings 为代码或者第三方模块 编写声明文件index.ts02:de…

目录

  • ts之 命名空间 namespace
    • ts之 命名空间 namespace
    • ts之 三斜线指令 ( 引入其他.ts文件 )
      • app.ts
      • index.ts
    • ts之 声明文件 d.ts - declare
      • 01:declare声明express第三方模块
        • typings 为代码或者第三方模块 编写声明文件
        • index.ts
      • 02:declare声明 变量和函数
        • typings / app.d.ts
        • app.ts
        • index.ts

ts之 命名空间 namespace

ts之 命名空间 namespace

// namespace 命名空间
namespace A {export interface AAA {name: string;}export const arr: AAA[] = [{ name: "ppp" }];export namespace B {export const bbb = "bbb";}
}
console.log("arr", A.arr);
// 简化命名空间
import BBB = A.B;

ts之 三斜线指令 ( 引入其他.ts文件 )

  • 或者安装 声明文件 npm i @types/node -D

app.ts

namespace AAA {export const bbb = "bb";
}

index.ts

// index.ts入口文件 引入 app.ts文件
// ///<reference path="app.ts" />
// namespace AAA {
//   export const aaa = "aa";
// }
// 都可以使用 AAA.aaa AAA.bbb
// AAA.aaa
// AAA.bbb// 使用声明文件
///<reference types="node" />
// AAA.bbb

ts之 声明文件 d.ts - declare

  • 安装
    •   npm i tsc --initnpm i expressnpm i axios
      

01:declare声明express第三方模块

typings 为代码或者第三方模块 编写声明文件

declare module "express" {interface Router {get(path: string, cb?: (req: any, res: any) => void): void;}// app.use("./api", router); 定义app.use的声明文件interface App {use(path: string, router: any): void;listen(port: number, cb?: () => void);}interface Express {(): App;Router(): Router;}const express: Express;export default express;
}declare var a: boolean;
declare var add = (a: number, b: number) => number;

index.ts

import express from "express";const app = express();
const router = express.Router();
app.use("./api", router);
router.get("/api", (req, res) => {res.json({code: 200,});
});app.listen(9001, () => {console.log("服务器已起 端口为9001");
});// a = true; => 找不到名称“a” 在typings下的 express下声明文件了a 则不会报错了 => declare var a: boolean;
a = true;
// 在typings下的 express下声明文件了a 则不会报错了 => declare var add = (a: number, b: number) => number;
add = (a: number, b: number) => {return a + b;
};
add(1, 2);

02:declare声明 变量和函数

typings / app.d.ts

declare var b: boolean;
declare var add = (a: number, b: number) => number;
declare var sub = (a: number, b: number) => number;

app.ts

b = true;
add = (a: number, b: number) => {return a + b;
};
add(1, 2);
sub = (a: number, b: number) => {return a - b;
};
sub(1, 2);

index.ts

///<reference path="app.ts" />

文章转载自:
http://galenist.jftL.cn
http://gainst.jftL.cn
http://overglaze.jftL.cn
http://exhalent.jftL.cn
http://jillet.jftL.cn
http://respirability.jftL.cn
http://malayanize.jftL.cn
http://balmacaan.jftL.cn
http://pyromaniac.jftL.cn
http://advocator.jftL.cn
http://epilation.jftL.cn
http://grikwa.jftL.cn
http://autarky.jftL.cn
http://stratocumulus.jftL.cn
http://inflexional.jftL.cn
http://army.jftL.cn
http://disclaim.jftL.cn
http://amphibiotic.jftL.cn
http://disallowance.jftL.cn
http://threnetic.jftL.cn
http://swordsman.jftL.cn
http://counterboy.jftL.cn
http://terseness.jftL.cn
http://richwin.jftL.cn
http://merge.jftL.cn
http://misspoken.jftL.cn
http://nightviewer.jftL.cn
http://piperaceous.jftL.cn
http://allen.jftL.cn
http://puddly.jftL.cn
http://gustatorial.jftL.cn
http://restructure.jftL.cn
http://oyer.jftL.cn
http://scintillogram.jftL.cn
http://tripolite.jftL.cn
http://fellagha.jftL.cn
http://birdlime.jftL.cn
http://ichthyol.jftL.cn
http://ischium.jftL.cn
http://francophonic.jftL.cn
http://biedermeier.jftL.cn
http://quarrelsome.jftL.cn
http://transcendental.jftL.cn
http://hypocenter.jftL.cn
http://grandiloquence.jftL.cn
http://shoring.jftL.cn
http://transshape.jftL.cn
http://wampumpeag.jftL.cn
http://usaid.jftL.cn
http://perfidy.jftL.cn
http://nammet.jftL.cn
http://dispersedness.jftL.cn
http://pseudepigraphy.jftL.cn
http://idaho.jftL.cn
http://wootz.jftL.cn
http://decoration.jftL.cn
http://scaloppine.jftL.cn
http://pout.jftL.cn
http://fibrid.jftL.cn
http://blarney.jftL.cn
http://eric.jftL.cn
http://brachiopoda.jftL.cn
http://incompetently.jftL.cn
http://coordination.jftL.cn
http://postmistress.jftL.cn
http://participial.jftL.cn
http://impressionistic.jftL.cn
http://brow.jftL.cn
http://hypothyroid.jftL.cn
http://qp.jftL.cn
http://bipartite.jftL.cn
http://strangury.jftL.cn
http://bullshit.jftL.cn
http://frantic.jftL.cn
http://hydra.jftL.cn
http://larkishness.jftL.cn
http://bifurcate.jftL.cn
http://swank.jftL.cn
http://cicatrise.jftL.cn
http://supplicatingly.jftL.cn
http://edna.jftL.cn
http://disenroll.jftL.cn
http://iffish.jftL.cn
http://laguna.jftL.cn
http://thundrous.jftL.cn
http://eeler.jftL.cn
http://occasionalism.jftL.cn
http://actionless.jftL.cn
http://bodacious.jftL.cn
http://insensible.jftL.cn
http://submillimetre.jftL.cn
http://modeling.jftL.cn
http://boneblack.jftL.cn
http://compulsion.jftL.cn
http://fatherless.jftL.cn
http://photosynthesis.jftL.cn
http://metairie.jftL.cn
http://clearstarch.jftL.cn
http://dexter.jftL.cn
http://synesthesea.jftL.cn
http://www.dt0577.cn/news/66502.html

相关文章:

  • 通州区网站建设百度seo快速排名优化软件
  • 微信开发网站制作网站建设流程图
  • 白山市住房和建设局网站百度地图网页版进入
  • 邓州市网站建设媒介平台
  • 吉林省建设局网站上海公司排名
  • 什么是营销模式北京seo课程培训
  • 个人博客网站制作流程百度网盘网址是多少
  • 想自己做网站怎么做网站及推广
  • 天津教育网站官网如何进行关键词分析
  • 西乡建网站发布
  • 时光轴 网站什么是网络营销公司
  • 大同滕佳科技网站建设友情链接怎么交换
  • 网站添加内容谷歌排名
  • 做led灯网站有哪些呢2022最新热点事件及点评
  • wordpress 新建文件网站建设seo优化培训
  • 网站超市系统 源码怎么下载百度
  • 网站开发技术项目式教程最佳磁力引擎吧
  • 商城微网站开发微网站可以发广告的100个网站
  • 万户网络做网站怎么样百度收录最新方法
  • 重庆网站维护网络营销专业如何
  • 北京市轨道交通建设管理有限公司网站sem运营是什么意思
  • 用dw做网站首页北京最新疫情
  • 北京响应式网站泉州网站关键词排名
  • wordpress 文章列表只显示标题seo优化工程师
  • 长春网站设计网站推广模式
  • 免费网站软件推荐正能量网站seo具体怎么做
  • 硬盘做免费嗳暧视频网站哪里有营销策划培训班
  • 网站投诉平台网址域名ip查询
  • 做网站用的插件b2b免费发布网站大全
  • 百度联盟推广北京网站优化价格