style: use Record instead of using index signature

This commit is contained in:
kotaindah55 2025-02-04 21:56:43 +02:00
parent 5d3c4af06b
commit 96038c809b
2 changed files with 4 additions and 4 deletions

View file

@ -3,7 +3,7 @@ import { MainFormat, Token } from "src/types";
import { ParserState } from "src/editor-mode/parser";
export class TokenQueue {
open: { [F in MainFormat]: Token | null } = {
open: Record<MainFormat, Token | null> = {
[Format.INSERTION]: null,
[Format.SPOILER]: null,
[Format.SUPERSCRIPT]: null,
@ -14,14 +14,14 @@ export class TokenQueue {
* Content token is generated and pushed automatically
* as its opening delimiter enter the queue.
*/
content: { [F in MainFormat]: Token | null } = {
content: Record<MainFormat, Token | null> = {
[Format.INSERTION]: null,
[Format.SPOILER]: null,
[Format.SUPERSCRIPT]: null,
[Format.SUBSCRIPT]: null,
[Format.HIGHLIGHT]: null,
};
close: { [F in MainFormat]: Token | null } = {
close: Record<MainFormat, Token | null> = {
[Format.INSERTION]: null,
[Format.SPOILER]: null,
[Format.SUPERSCRIPT]: null,

View file

@ -1,7 +1,7 @@
import { Format } from "src/enums";
import { MainFormat } from "src/types";
export const FormatRules: { [P in MainFormat]: {char: string, length: number, exactLen: boolean, allowSpace: boolean, getEl: () => Element} } = {
export const FormatRules: Record<MainFormat, { char: string, length: number, exactLen: boolean, allowSpace: boolean, getEl: () => Element }> = {
[Format.INSERTION]: {
char: "+",
length: 2,