当前位置:网站首页>Generics of typescript
Generics of typescript
2022-06-21 18:27:00 【CupidoZ】
// ts Generic programming for
function add<type>(a:type):type{
return a
}
add("ajaj")
add(123456)
add(false)
// Generic constraint properties
// Constrained generics have a length attribute
function f01<type>(a:type[]):type[]{
console.log(a.length);
return a
}
add("ajaj")
add(123456)
add(false)
// Interface type constraints
function f02<type extends IArguments>(a:type):type{
return a
}
add("ajaj")
add(123456)
add(false)
TS Yes js Added generic support , Parameter encapsulation can be more flexible
边栏推荐
- Inheritance of typescript
- 最佳网络数据抓包工具mitmproxy
- I got a pay cut in disguise
- EtherCAT igh函数尝试
- 基本文件操作
- Cann training camp Season 2 - the opening ceremony | it starts at 7:30 tonight on time. You can't miss it!
- 网络爬虫开发工具:Screaming Frog SEO Spider
- Technical architecture of large websites | information encryption technology and key security management
- [pwn基础]Pwntools学习
- 大学物理第9章·振动
猜你喜欢

Type checking for typescript

在线文档协作:办公必备高效率神器

AI自己写代码让智能体进化!OpenAI的大模型有“人类思想”那味了

基于AM4377的EtherCAT主站控制stm32从站

markdown写作软件:Ulysses v27

RT thread persimmon pie M7 Quanzhi f133 DDR running xboot

What is the S3 protocol that we are talking about every day? This article takes you to understand the story behind S3

雷军的千亿失误?

CentOS使用composer install 报错 - phpunitphpunit 8

System V IPC与POSIX IPC
随机推荐
国元期货开户可靠吗?新手如何安全开户?
原码、补码、反码的关系
Node的json解析
EtherCAT igh主站控制3个台达asdaa2伺服转圈圈
C3—Qt实现五子棋小游戏(一)2021.11.07
Node的字符处理
Typescript接口
力扣160. 相交链表
EtherCAT igh函数尝试
Gartner 网络研讨会 “九问数字化转型” 会后感
Node的全局安装
如何使用 DATAX 以 UPSERT 语义更新下游 ORACLE 数据库中的数据
Type checking for typescript
AI自己写代码让智能体进化!OpenAI的大模型有“人类思想”那味了
AWS Device Shadow使用
System V IPC与POSIX IPC
EtherCAT igh 'Fatal Sync Error'——0x002C,0x001A
Inheritance of typescript
Move Protocol Beta测试版进行时,瓜分生态核心权益MOMO
PHP输出函数