当前位置:网站首页>TS typescript type declaration special declaration field number is handled when the key key
TS typescript type declaration special declaration field number is handled when the key key
2022-07-07 15:47:00 【Sam young】
Numbers are named for keys
const data :{
[key: number]: string} = {
1: 'a',
2: 'b'
}
// data[1] = 'a'
// data[2] = 'b'
When the object key returned by the back end is uncertain
const data :{
[key: string]: string} = {
'xxx': 'a',
'abc': 'b'
}
// data['xxx'] = 'a'
// data['abc'] = 'b'
Common types
export type StringType = NonNullable<string | null | undefined>;
export type NumberType = NonNullable<number | null | undefined>;
export type BooleanType = NonNullable<boolean | null | undefined>;
export type StringNumberType = NonNullable<string | number | null | undefined>;
/** With number As key Of */
export type NumberKey<T = any> = {
[key: number]: T }
/** string As key Of */
export type StringKey<T = any> = {
[key: string]: T }
export type Option = {
label: string; value: string }
边栏推荐
- OpenGL's distinction and understanding of VAO, VBO and EBO
- Excerpted words
- 大表delete删数据导致数据库异常解决
- HPDC smart base Talent Development Summit essay
- 15. Using the text editing tool VIM
- When opening the system window under UE4 shipping, the problem of crash is attached with the plug-in download address
- 2.Golang基础知识
- 【搞船日记】【Shapr3D的STL格式转Gcode】
- 【数字IC验证快速入门】26、SystemVerilog项目实践之AHB-SRAMC(6)(APB协议基本要点)
- [server data recovery] a case of RAID data recovery of a brand StorageWorks server
猜你喜欢
【數字IC驗證快速入門】20、SystemVerilog學習之基本語法7(覆蓋率驅動...內含實踐練習)
unnamed prototyped parameters not allowed when body is present
【数字IC验证快速入门】29、SystemVerilog项目实践之AHB-SRAMC(9)(AHB-SRAMC SVTB Overview)
[quickstart to Digital IC Validation] 20. Basic syntax for system verilog Learning 7 (Coverage Driven... Including practical exercises)
【微信小程序】Chapter(5):微信小程序基础API接口
Whole process analysis of unity3d rendering pipeline
[target detection] yolov5 Runtong voc2007 data set
Iterator and for of.. loop
Getting started with webgl (4)
webgl_ Enter the three-dimensional world (2)
随机推荐
[quick start of Digital IC Verification] 23. AHB sramc of SystemVerilog project practice (3) (basic points of AHB protocol)
AB package details in unity (super detail, features, packaging, loading, manager)
After UE4 is packaged, mesh has no material problem
Stm32f103c8t6 PWM drive steering gear (sg90)
如何在opensea批量发布NFT(Rinkeby测试网)
webgl_ Graphic transformation (rotation, translation, zoom)
Android -- jetpack: the difference between livedata setValue and postvalue
MySQL bit type resolution
Async and await
Nacos一致性协议 CP/AP/JRaft/Distro协议
[quick start of Digital IC Verification] 20. Basic grammar of SystemVerilog learning 7 (coverage driven... Including practical exercises)
Annexb and avcc are two methods of data segmentation in decoding
LeetCode3_ Longest substring without duplicate characters
VS2005 strange breakpoint is invalid or member variable value cannot be viewed
[markdown grammar advanced] make your blog more exciting (IV: set font style and color comparison table)
[server data recovery] a case of RAID data recovery of a brand StorageWorks server
Unity's ASE realizes cartoon flame
【数字IC验证快速入门】20、SystemVerilog学习之基本语法7(覆盖率驱动...内含实践练习)
写一篇万字长文《CAS自旋锁》送杰伦的新专辑登顶热榜
[data mining] visual pattern mining: hog feature + cosine similarity /k-means clustering