diff --git a/yaml/_loader_state.ts b/yaml/_loader_state.ts index b0083843e..8624b6a92 100644 --- a/yaml/_loader_state.ts +++ b/yaml/_loader_state.ts @@ -67,8 +67,6 @@ export interface LoaderStateOptions { onWarning?(error: Error): void; } -type ResultType = unknown[] | Record | string; - const ESCAPED_HEX_LENGTHS = new Map([ [0x78, 2], // x [0x75, 4], // u @@ -155,7 +153,7 @@ export class LoaderState { tag?: string | null; anchor?: string | null; kind?: string | null; - result: ResultType | null = ""; + result: unknown[] | Record | string | null = ""; constructor( input: string, @@ -863,7 +861,7 @@ function readFlowCollection(state: LoaderState, nodeIndent: number): boolean { let ch = state.peek(); let terminator: number; let isMapping = true; - let result: ResultType = {}; + let result = {}; if (ch === LEFT_SQUARE_BRACKET) { terminator = RIGHT_SQUARE_BRACKET; isMapping = false; @@ -958,7 +956,7 @@ function readFlowCollection(state: LoaderState, nodeIndent: number): boolean { ), ); } else { - (result as ResultType[]).push(keyNode as ResultType); + (result as unknown[]).push(keyNode); } skipSeparationSpace(state, true, nodeIndent);