summaryrefslogtreecommitdiff
path: root/std/encoding/_yaml
diff options
context:
space:
mode:
Diffstat (limited to 'std/encoding/_yaml')
-rw-r--r--std/encoding/_yaml/dumper/dumper.ts9
-rw-r--r--std/encoding/_yaml/example/sample_document.ts3
-rw-r--r--std/encoding/_yaml/loader/loader.ts2
-rw-r--r--std/encoding/_yaml/loader/loader_state.ts3
-rw-r--r--std/encoding/_yaml/stringify.ts5
-rw-r--r--std/encoding/_yaml/type.ts4
-rw-r--r--std/encoding/_yaml/utils.ts2
7 files changed, 19 insertions, 9 deletions
diff --git a/std/encoding/_yaml/dumper/dumper.ts b/std/encoding/_yaml/dumper/dumper.ts
index e1f1a142a..ec517ffb2 100644
--- a/std/encoding/_yaml/dumper/dumper.ts
+++ b/std/encoding/_yaml/dumper/dumper.ts
@@ -499,7 +499,9 @@ function writeScalar(
return `'${string.replace(/'/g, "''")}'`;
case STYLE_LITERAL:
return `|${blockHeader(string, state.indent)}${
- dropEndingNewline(indentString(string, indent))
+ dropEndingNewline(
+ indentString(string, indent),
+ )
}`;
case STYLE_FOLDED:
return `>${blockHeader(string, state.indent)}${
@@ -867,7 +869,10 @@ function inspectNode(
}
}
-function getDuplicateReferences(object: object, state: DumperState): void {
+function getDuplicateReferences(
+ object: Record<string, unknown>,
+ state: DumperState,
+): void {
const objects: Any[] = [],
duplicatesIndexes: number[] = [];
diff --git a/std/encoding/_yaml/example/sample_document.ts b/std/encoding/_yaml/example/sample_document.ts
index f66b3c417..8ef714d42 100644
--- a/std/encoding/_yaml/example/sample_document.ts
+++ b/std/encoding/_yaml/example/sample_document.ts
@@ -7,7 +7,8 @@ import { parse } from "../../yaml.ts";
const yml = Deno.readFileSync(`${Deno.cwd()}/example/sample_document.yml`);
const document = new TextDecoder().decode(yml);
- const obj = parse(document) as object;
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ const obj = parse(document) as Record<string, any>;
console.log(obj);
let i = 0;
diff --git a/std/encoding/_yaml/loader/loader.ts b/std/encoding/_yaml/loader/loader.ts
index 216e315f2..18bab93f5 100644
--- a/std/encoding/_yaml/loader/loader.ts
+++ b/std/encoding/_yaml/loader/loader.ts
@@ -813,7 +813,7 @@ function readFlowCollection(state: LoaderState, nodeIndent: number): boolean {
valueNode,
);
} else if (isPair) {
- (result as Array<{}>).push(
+ (result as ArrayObject[]).push(
storeMappingPair(
state,
null,
diff --git a/std/encoding/_yaml/loader/loader_state.ts b/std/encoding/_yaml/loader/loader_state.ts
index 60a7ccabc..81edeb28d 100644
--- a/std/encoding/_yaml/loader/loader_state.ts
+++ b/std/encoding/_yaml/loader/loader_state.ts
@@ -22,7 +22,8 @@ export interface LoaderStateOptions {
onWarning?(this: null, e?: YAMLError): void;
}
-export type ResultType = [] | {} | string;
+// eslint-disable-next-line @typescript-eslint/no-explicit-any
+export type ResultType = any[] | Record<string, any> | string;
export class LoaderState extends State {
public documents: Any[] = [];
diff --git a/std/encoding/_yaml/stringify.ts b/std/encoding/_yaml/stringify.ts
index 9b3b5a80e..ed7b82d84 100644
--- a/std/encoding/_yaml/stringify.ts
+++ b/std/encoding/_yaml/stringify.ts
@@ -13,6 +13,9 @@ export type DumpOptions = DumperStateOptions;
*
* You can disable exceptions by setting the skipInvalid option to true.
*/
-export function stringify(obj: object, options?: DumpOptions): string {
+export function stringify(
+ obj: Record<string, unknown>,
+ options?: DumpOptions,
+): string {
return dump(obj, options);
}
diff --git a/std/encoding/_yaml/type.ts b/std/encoding/_yaml/type.ts
index 18dee338c..89a91106b 100644
--- a/std/encoding/_yaml/type.ts
+++ b/std/encoding/_yaml/type.ts
@@ -17,7 +17,7 @@ interface TypeOptions {
resolve?: (data: Any) => boolean;
construct?: (data: string) => Any;
instanceOf?: Any;
- predicate?: (data: object) => boolean;
+ predicate?: (data: Record<string, unknown>) => boolean;
represent?: RepresentFn | ArrayObject<RepresentFn>;
defaultStyle?: StyleVariant;
styleAliases?: ArrayObject;
@@ -31,7 +31,7 @@ export class Type {
public tag: string;
public kind: KindType | null = null;
public instanceOf: Any;
- public predicate?: (data: object) => boolean;
+ public predicate?: (data: Record<string, unknown>) => boolean;
public represent?: RepresentFn | ArrayObject<RepresentFn>;
public defaultStyle?: StyleVariant;
public styleAliases?: ArrayObject;
diff --git a/std/encoding/_yaml/utils.ts b/std/encoding/_yaml/utils.ts
index e009ae3cf..3d4e48771 100644
--- a/std/encoding/_yaml/utils.ts
+++ b/std/encoding/_yaml/utils.ts
@@ -38,7 +38,7 @@ export function isUndefined(value: unknown): value is undefined {
return value === undefined;
}
-export function isObject(value: unknown): value is object {
+export function isObject(value: unknown): value is Record<string, unknown> {
return value !== null && typeof value === "object";
}