[js-yaml] Revert return type of loader functions to any (#26883)

Reverts https://github.com/DefinitelyTyped/DefinitelyTyped/pull/24385
This commit is contained in:
ikokostya
2018-07-03 19:35:12 +03:00
committed by Mohamed Hegazy
parent 52a1ad8ea6
commit ca19f9ce6c
2 changed files with 12 additions and 14 deletions

View File

@@ -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;

View File

@@ -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);
// -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --