From 96038c809b6f7c7ce8bbecd2bda879cd99e43d37 Mon Sep 17 00:00:00 2001 From: kotaindah55 Date: Tue, 4 Feb 2025 21:56:43 +0200 Subject: [PATCH] style: use Record instead of using index signature --- src/editor-mode/parser/TokenQueue.ts | 6 +++--- src/shared-configs/FormatRules.ts | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/editor-mode/parser/TokenQueue.ts b/src/editor-mode/parser/TokenQueue.ts index 0765fe6..98f1d90 100644 --- a/src/editor-mode/parser/TokenQueue.ts +++ b/src/editor-mode/parser/TokenQueue.ts @@ -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 = { [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 = { [Format.INSERTION]: null, [Format.SPOILER]: null, [Format.SUPERSCRIPT]: null, [Format.SUBSCRIPT]: null, [Format.HIGHLIGHT]: null, }; - close: { [F in MainFormat]: Token | null } = { + close: Record = { [Format.INSERTION]: null, [Format.SPOILER]: null, [Format.SUPERSCRIPT]: null, diff --git a/src/shared-configs/FormatRules.ts b/src/shared-configs/FormatRules.ts index 671a362..4de2b50 100644 --- a/src/shared-configs/FormatRules.ts +++ b/src/shared-configs/FormatRules.ts @@ -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 Element }> = { [Format.INSERTION]: { char: "+", length: 2,