Làm thế nào để định nghĩa một lớp TypeScript có index signature?

{{FormatNumbertoThousand(model.total_like)}} lượt thích
127 lượt xem
Typescript senior

Để định nghĩa một lớp có index signature, chỉ cần viết index signature trong lớp:

interface IRawParams {
   [key: string]: any
} 

class Foo implements IRawParams {
   [k: string]: any;
}
{{login.error}}