当前位置:网站首页>Typescript type
Typescript type
2022-06-26 06:19:00 【One at the front】
type Common writing method of :
// not used type
let sum:(x:number,y:number) => number
sum=(x,y)=>x+y
const result = sum(1,2)
console.log(result)
// Use type
type PlusType=(x:number,y:number)=>number
let sum2:PlusType=(x,y)=>x+y
const result2=sum2(2,3)
console.log(result2)
// type Union type
type strOrNum=string|number
let result3:strOrNum='12'
result3=12
// More commonly used
type Directions='Up'|'Down'|'Left'|'Right'
let toWhere:Directions='Down'
//type Combined interface
interface IName{name:string}
type IPerson=IName&{age:number}
let person:IPerson={name:'jim',age:123}边栏推荐
- Static proxy mode
- Five solutions across domains
- 如何让主线程等待子线程执行完毕后再执行
- Selective search for object recognition paper notes [image object segmentation]
- MySQL-08
- Gof23 - prototype mode
- How to select and build a real-time data warehouse scheme
- 个人博客系统需求分析
- Selective Search for Object Recognition 论文笔记【图片目标分割】
- University Information Management System
猜你喜欢

Mysql-10 (key)

Evolution history of qunar Bi platform construction

Efk upgrade to Clickhouse log storage practice

Transaction and message semantics

消息队列-全方位对比
Web components series (10) -- realize the basic layout of mycard

Data visualization practice: Experimental Report
![[spark] how to implement spark SQL field blood relationship](/img/8e/96f83844b480916b2662b0cf1fdf65.jpg)
[spark] how to implement spark SQL field blood relationship

实时数仓方案如何选型和构建

TCP connection and disconnection, detailed explanation of state transition diagram
随机推荐
TCP連接與斷開,狀態遷移圖詳解
Library management system
TS泛型在函数、接口、类中使用介绍
Mongodb -- use mongodb to intercept the string content in the field and perform grouping statistics
Data visualization practice: Data Visualization
Implement the runnable interface
"= =" difference from "equals"
Library management system
PyTorch使用多GPU并行训练及其原理和注意事项
Everything is a vector. The service practice of iqiyi online vector recall project
numpy. tile()
GoF23—原型模式
实时数仓方案如何选型和构建
MySQL-08
Prometheus和Zabbix的对比
04. basic data type - list, tuple
volatile应用场景
SQL Server view
Spark source code analysis (I): RDD collection data - partition data allocation
Selective search for object recognition paper notes [image object segmentation]