当前位置:网站首页>[TS] type alias
[TS] type alias
2022-06-29 01:20:00 【A meteor unwilling to fall】
List of articles
Basic usage
type: Type aliases are used to give a type a new name , You can use the same type multiple times and use the same name .typeType alias syntax :
type Point = {
x: number;
y: number;
};
function printCoord(pt: Point) {
console.log("The coordinate's x value is " + pt.x);
console.log("The coordinate's y value is " + pt.y);
}
printCoord({
x: 100, y: 100 });
- You can use a type alias to name any type , Not just object types .
- Commonly used for union types .
type test = number; // Basic types
let num: test = 10;
type userOjb = {
name:string} // object
type getName = ()=>string // function
type data = [number,string] // Tuples
type numOrFun = number | getName // Joint type
边栏推荐
- Statistical learning method (2/22) perceptron
- [Architect (Part 38)] locally install the latest version of MySQL database developed by the server
- TypeScript(4)接口
- sqlalchemy的基本使用
- I want to buy stocks today, OK? Is it safe to open an account online now?
- Browser cache library design summary (localstorage/indexeddb)
- Teach you how to understand the test environment project deployment
- Cocoscrreator dynamically switches skeletondata to update bones
- Depth first search to realize the problem of catching cattle
- UVM: message mechanism
猜你喜欢

Check the open source projects of yyds in June!

测试只能干到35岁?35岁+的测试就会失业?

TypeScript(4)接口

EasyCVR服务private.pem文件被清空,导致无法正常启动该如何处理?
![[RRT 3D path planning] rapid expansion of random tree UAV 3D path planning based on MATLAB [including Matlab source code phase 1914]](/img/85/a2c159e7051cca01fe7ea177a5b1eb.png)
[RRT 3D path planning] rapid expansion of random tree UAV 3D path planning based on MATLAB [including Matlab source code phase 1914]

How can multidimensional analysis pre summary work?

How to solve the problem of Caton screen when easycvr plays video?

Interviewer: with the for loop, why do you need foreach??

With this tool, automatic identification and verification code is no longer a problem

Exclusive analysis | about resume and interview
随机推荐
mysql数据库修改密码
不同的子序列问题I
198. house raiding
EasyCVR新建用户后,视频调阅页面不能点击的问题修复
Werewolf kill casual game wechat applet template source code / wechat game source code
【Proteus仿真】4x4矩阵键盘中断方式扫描 +数码管显示
Is it safe to open a securities account at qiniu business school in 2022?
Rasa dialogue robot helpdesk (V)
[MCU club] design of blind water cup based on MCU [physical design]
FSS object storage how to access the Intranet
第八天 脚本与音频
TypeScript(7)泛型
Edrawmax mind map, edrawmax organization chart
How to solve the problem of Caton screen when easycvr plays video?
基于.NetCore开发博客项目 StarBlog - (13) 加入友情链接功能
Is Huatai Securities safe
Docker中安裝Oracle數據庫
我想今天买股票,可以么?现在网上开户安全么?
Statistical learning method (2/22) perceptron
最大路径和问题(摘樱桃问题)