diff --git a/types/js-yaml/index.d.ts b/types/js-yaml/index.d.ts index da2d2a36c8..1dfa56c5a5 100644 --- a/types/js-yaml/index.d.ts +++ b/types/js-yaml/index.d.ts @@ -6,10 +6,8 @@ export as namespace jsyaml; -export type DocumentLoadResult = object | undefined; - -export function safeLoad(str: string, opts?: LoadOptions): DocumentLoadResult; -export function load(str: string, opts?: LoadOptions): DocumentLoadResult; +export function safeLoad(str: string, opts?: LoadOptions): any; +export function load(str: string, opts?: LoadOptions): any; export class Type { constructor(tag: string, opts?: TypeConstructorOptions); @@ -30,10 +28,10 @@ export class Schema implements SchemaDefinition { static create(schemas: Schema[] | Schema, types: Type[] | Type): Schema; } -export function safeLoadAll(str: string, iterator?: undefined, opts?: LoadOptions): DocumentLoadResult[]; +export function safeLoadAll(str: string, iterator?: undefined, opts?: LoadOptions): any[]; export function safeLoadAll(str: string, iterator: (doc: any) => void, opts?: LoadOptions): undefined; -export function loadAll(str: string, iterator?: undefined, opts?: LoadOptions): DocumentLoadResult[]; +export function loadAll(str: string, iterator?: undefined, opts?: LoadOptions): any[]; export function loadAll(str: string, iterator: (doc: any) => void, opts?: LoadOptions): undefined; diff --git a/types/js-yaml/js-yaml-tests.ts b/types/js-yaml/js-yaml-tests.ts index 9a61da204f..2d67b99192 100644 --- a/types/js-yaml/js-yaml-tests.ts +++ b/types/js-yaml/js-yaml-tests.ts @@ -109,19 +109,19 @@ type.styleAliases; // -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -// $ExpectType DocumentLoadResult +// $ExpectType any yaml.safeLoad(str); -// $ExpectType DocumentLoadResult +// $ExpectType any yaml.safeLoad(str, loadOpts); -// $ExpectType DocumentLoadResult +// $ExpectType any yaml.load(str); -// $ExpectType DocumentLoadResult +// $ExpectType any yaml.load(str, loadOpts); // -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -// $ExpectType DocumentLoadResult[] +// $ExpectType any[] yaml.safeLoadAll(str); // $ExpectType undefined @@ -132,10 +132,10 @@ yaml.safeLoadAll(str, (doc) => { yaml.safeLoadAll(str, (doc) => { value = doc; }, loadOpts); -// $ExpectType DocumentLoadResult[] +// $ExpectType any[] value = yaml.safeLoadAll(str, undefined, loadOpts); -// $ExpectType DocumentLoadResult[] +// $ExpectType any[] value = yaml.loadAll(str); // $ExpectType undefined @@ -146,7 +146,7 @@ yaml.loadAll(str, (doc) => { yaml.loadAll(str, (doc) => { value = doc; }, loadOpts); -// $ExpectType DocumentLoadResult[] +// $ExpectType any[] value = yaml.loadAll(str, undefined, loadOpts); // -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --