当前位置:网站首页>[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
边栏推荐
- Pytorch -- use and modification of existing network model
- 统计学习方法(2/22)感知机
- 肖特基二极管在防止电源反接的作用
- EdrawMax思维导图,EdrawMax组织结构图
- How to mount FSS object storage locally
- Mysql database password modification
- Sword finger offer 14- I. cut rope
- What is the difference between immunohistochemistry and immunohistochemistry?
- Day 7 scripts and special effects
- Analysis Framework -- establishment of user experience measurement data system
猜你喜欢

《Reinforcement learning based parameters adaption method for particleswarm optimization》代码复现
![[MCU club] design of blind water cup based on MCU [physical design]](/img/06/93d7a8fd97cdccbc639d2a95b10826.jpg)
[MCU club] design of blind water cup based on MCU [physical design]
![[Fire Detection] forest fire detection system based on Matlab GUI (with panel) [including Matlab source code phase 1921]](/img/fa/17731d46a70112faadbfd0e61be143.png)
[Fire Detection] forest fire detection system based on Matlab GUI (with panel) [including Matlab source code phase 1921]

PAT甲级真题1165

【图像处理】基于matlab实现图像曲线调整系统

Teach you how to understand the test environment project deployment

SRAM和DRAM之间的异同

第七天 脚本与特效

Werewolf kill casual game wechat applet template source code / wechat game source code

Day 8 script and audio
随机推荐
FSS object storage how to access the Intranet
Misunderstanding of innovation by enterprise and it leaders
多维分析预汇总应该怎样做才管用?
[temperature detection] thermal infrared image temperature detection system based on Matlab GUI [including Matlab source code 1920]
[MCU club] design of classroom number detection based on MCU [physical design]
盘点 6 月 yyds 的开源项目!
利用kubernetes资源锁完成自己的HA应用
Uvm:field automation mechanism
[RRT 3D path planning] rapid expansion of random tree UAV 3D path planning based on MATLAB [including Matlab source code phase 1914]
EasyCVR播放视频出现卡顿花屏时如何解决?
XML and other file contents in idea cannot be highlighted, and the file becomes gray
Flask-SQLAlchemy的基本使用
UI highly adaptive modification scheme
mysql数据库修改密码
【Proteus仿真】4x4矩阵键盘中断方式扫描 +数码管显示
IPFs Brief
[MCU club] design of blind water cup based on MCU [physical design]
第八天 脚本与音频
测试只能干到35岁?35岁+的测试就会失业?
[MCU club] design of classroom number detection based on MCU [simulation design]