got tests running, fix up types

This commit is contained in:
Fred K. Schott
2018-03-19 10:59:34 -07:00
parent dbe58aecc8
commit 97ca4f14ed
2 changed files with 20 additions and 12 deletions

View File

@@ -28,8 +28,12 @@ export class Schema implements SchemaDefinition {
static create(schemas: Schema[] | Schema, types: Type[] | Type): Schema;
}
export function safeLoadAll(str: string, iterator?: (doc: any) => void, opts?: LoadOptions): DocumentLoadResult[] | undefined;
export function loadAll(str: string, iterator?: (doc: any) => void, opts?: LoadOptions): DocumentLoadResult[] | undefined;
export function safeLoadAll(str: string, iterator?: undefined, opts?: LoadOptions): DocumentLoadResult[];
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: (doc: any) => void, opts?: LoadOptions): undefined;
export function safeDump(obj: any, opts?: DumpOptions): string;
export function dump(obj: any, opts?: DumpOptions): string;

View File

@@ -109,40 +109,44 @@ type.styleAliases;
// -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
// $ExpectType any
// $ExpectType DocumentLoadResult
yaml.safeLoad(str);
// $ExpectType any
// $ExpectType DocumentLoadResult
yaml.safeLoad(str, loadOpts);
// $ExpectType any
// $ExpectType DocumentLoadResult
yaml.load(str);
// $ExpectType any
// $ExpectType DocumentLoadResult
yaml.load(str, loadOpts);
// -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
// $ExpectType any
// $ExpectType DocumentLoadResult[]
yaml.safeLoadAll(str);
// $ExpectType any
// $ExpectType undefined
yaml.safeLoadAll(str, (doc) => {
value = doc;
});
// $ExpectType any
// $ExpectType undefined
yaml.safeLoadAll(str, (doc) => {
value = doc;
}, loadOpts);
// $ExpectType DocumentLoadResult[]
value = yaml.safeLoadAll(str, undefined, loadOpts);
// $ExpectType any
// $ExpectType DocumentLoadResult[]
value = yaml.loadAll(str);
// $ExpectType any
// $ExpectType undefined
yaml.loadAll(str, (doc) => {
value = doc;
});
// $ExpectType any
// $ExpectType undefined
yaml.loadAll(str, (doc) => {
value = doc;
}, loadOpts);
// $ExpectType DocumentLoadResult[]
value = yaml.loadAll(str, undefined, loadOpts);
// -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --