banner
SlhwSR

SlhwSR

热爱技术的一名全栈开发者
github
bilibili

Implementing custom signatures in TypeScript indexes

In a type constraint, if other fixed types are specified, users are required to add constraints when passing other specifications, such as keys ending with "End".

type C={
 name:string
 [key:`${string}End`]:string | number
 age?:number
}
// That is
const type:C={
  name:"safajfs"
  ioEnd:"asd"
} 
Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.