当前位置:网站首页>[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
边栏推荐
- linux7(centos7)设置oracle11开机自启动
- Magic Quadrant of motianlun's 2021 China Database
- [js practice every m days] JS export object analysis based on libcef application (steam)
- 同期群分析是什么?教你用 SQL 来搞定
- 启牛学堂帮忙开证券账户是安全靠谱的吗?个人如何开
- [image processing] image curve adjustment system based on MATLAB
- Depth first search to realize the problem of catching cattle
- Rasa dialogue robot helpdesk (V)
- Is Huatai Securities safe
- Day 8 script and audio
猜你喜欢

What kind of life is a tester with a monthly salary of over 10000?
UI highly adaptive modification scheme

【图像增强】基于matlab人工多重曝光融合AMEF图像去雾【含Matlab源码 1916期】
![[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]

Seven mistakes in IT Governance and how to avoid them

Linux7 (centos7) setting oracle11 boot auto start

有了这款工具,自动化识别验证码再也不是问题

Finally understand the difference between DOM XSS and reflection XSS

What is the difference between immunohistochemistry and immunohistochemistry?

统计学习方法(2/22)感知机
随机推荐
Blazor University (34)表单 —— 获得表单状态
Uvm:factory mechanism
Basic use of flask Sqlalchemy
TypeScript(5)类、继承、多态
最新Justnews主题源码6.0.1开心版+社交问答插件2.3.1+附教程
Edrawmax mind map, edrawmax organization chart
[MCU club] design of blind water cup based on MCU [physical design]
Check the open source projects of yyds in June!
Misunderstanding of innovation by enterprise and it leaders
月薪过万的测试员,是一种什么样的生活状态?
Streaming media cluster application and configuration: how to deploy multiple easycvr on one server?
立创eda学习笔记:铺铜死区?孤岛?死铜?
Hello i am back
Teach you how to understand the test environment project deployment
be based on. NETCORE development blog project starblog - (13) add friendship link function
[MCU club] design of classroom number detection based on MCU [physical design]
Database - optimizer
Exclusive analysis | about resume and interview
[UVM] my main_ Why can't the case exit when the phase runs out? Too unreasonable!
Drawing ECG curve with WPF