From 4b4f721766ac1fb6867070ce4651475329a13379 Mon Sep 17 00:00:00 2001 From: Andrew Eisenberg Date: Tue, 15 Aug 2017 07:51:58 -0600 Subject: [PATCH] Updates type definitions for js-yaml Includes a more complete definition for yaml.Schema.create(). --- types/js-yaml/index.d.ts | 5 +++-- types/js-yaml/js-yaml-tests.ts | 8 +++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/types/js-yaml/index.d.ts b/types/js-yaml/index.d.ts index 2817689c29..8f7c0a346d 100644 --- a/types/js-yaml/index.d.ts +++ b/types/js-yaml/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for js-yaml 3.9.0 +// Type definitions for js-yaml 3.9.1 // Project: https://github.com/nodeca/js-yaml // Definitions by: Bart van der Schoor , Sebastian Clausen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -14,7 +14,8 @@ declare namespace jsyaml { } export class Schema { constructor(definition: SchemaDefinition); - public static create(args: any[]): Schema; + public static create(types: Type[] | Type): Schema; + public static create(schemas: Schema[] | Schema, types: Type[] | Type): Schema; } export function safeLoadAll(str: string, iterator: (doc: any) => void, opts?: LoadOptions): any; diff --git a/types/js-yaml/js-yaml-tests.ts b/types/js-yaml/js-yaml-tests.ts index 494b815572..aff53acd3c 100644 --- a/types/js-yaml/js-yaml-tests.ts +++ b/types/js-yaml/js-yaml-tests.ts @@ -106,4 +106,10 @@ value = yaml.dump(str, dumpOpts); value = new yaml.YAMLException(); value = new yaml.Type(str, typeConstructorOptions); -value = yaml.Schema.create([schemaDefinition]); +value = new yaml.Schema(schemaDefinition); +value = yaml.Schema.create([new yaml.Type(str)]); +value = yaml.Schema.create(new yaml.Type(str)); +value = yaml.Schema.create(new yaml.Schema(schemaDefinition), [new yaml.Type(str)]); +value = yaml.Schema.create([new yaml.Schema(schemaDefinition)], [new yaml.Type(str)]); +value = yaml.Schema.create(new yaml.Schema(schemaDefinition), new yaml.Type(str)); +value = yaml.Schema.create([new yaml.Schema(schemaDefinition)], new yaml.Type(str));