1
- // Type definitions for js-yaml 3.0 .2
1
+ // Type definitions for js-yaml 3.5 .2
2
2
// Project: https://github.com/nodeca/js-yaml
3
- // Definitions by: Bart van der Schoor <https://github.com/Bartvds>
4
- // Definitions: https://github.com/borisyankov /DefinitelyTyped
3
+ // Definitions by: Bart van der Schoor <https://github.com/Bartvds>, Sebastian Clausen <https://github.com/sclausen>
4
+ // Definitions: https://github.com/DefinitelyTyped /DefinitelyTyped
5
5
6
- declare module jsyaml {
6
+ declare namespace jsyaml {
7
7
export function safeLoad ( str : string , opts ?: LoadOptions ) : any ;
8
8
export function load ( str : string , opts ?: LoadOptions ) : any ;
9
9
10
+ export class Type implements TypeConstructorOptions {
11
+ constructor ( tag : string , opts ?: TypeConstructorOptions ) ;
12
+ tag : string ;
13
+ }
14
+ export class Schema {
15
+ constructor ( definition : SchemaDefinition ) ;
16
+ public static create ( args : any [ ] ) : Schema ;
17
+ }
18
+
10
19
export function safeLoadAll ( str : string , iterator : ( doc : any ) => void , opts ?: LoadOptions ) : any ;
11
20
export function loadAll ( str : string , iterator : ( doc : any ) => void , opts ?: LoadOptions ) : any ;
12
21
13
22
export function safeDump ( obj : any , opts ?: DumpOptions ) : string ;
14
- export function dump ( obj : any , opts ?: DumpOptions ) : string
23
+ export function dump ( obj : any , opts ?: DumpOptions ) : string ;
15
24
16
25
export interface LoadOptions {
17
26
// string to be used as a file path in error/warning messages.
@@ -29,12 +38,29 @@ declare module jsyaml {
29
38
skipInvalid ?: boolean ;
30
39
// specifies level of nesting, when to switch from block to flow style for collections. -1 means block style everwhere
31
40
flowLevel ?: number ;
32
- // Each tag may have own set of styles. - "tag" => "style" map.
41
+ // Each tag may have own set of styles. - "tag" => "style" map.
33
42
styles ?: Object ;
34
43
// specifies a schema to use.
35
44
schema ?: any ;
36
45
}
37
46
47
+ export interface TypeConstructorOptions {
48
+ kind ?: string ;
49
+ resolve ?: Function ;
50
+ construct ?: Function ;
51
+ instanceOf ?: Object ;
52
+ predicate ?: string ;
53
+ represent ?: Function ;
54
+ defaultStyle ?: string ;
55
+ styleAliases ?: Object ;
56
+ }
57
+
58
+ export interface SchemaDefinition {
59
+ implicit ?: any [ ] ;
60
+ explicit ?: any [ ] ;
61
+ include ?: any [ ] ;
62
+ }
63
+
38
64
// only strings, arrays and plain objects: http://www.yaml.org/spec/1.2/spec.html#id2802346
39
65
export var FAILSAFE_SCHEMA : any ;
40
66
// only strings, arrays and plain objects: http://www.yaml.org/spec/1.2/spec.html#id2802346
@@ -45,6 +71,13 @@ declare module jsyaml {
45
71
export var DEFAULT_SAFE_SCHEMA : any ;
46
72
// all supported YAML types.
47
73
export var DEFAULT_FULL_SCHEMA : any ;
74
+ export var MINIMAL_SCHEMA : any ;
75
+ export var SAFE_SCHEMA : any ;
76
+
77
+ export class YAMLException extends Error {
78
+ constructor ( reason ?: any , mark ?: any ) ;
79
+ toString ( compact ?: boolean ) : string ;
80
+ }
48
81
}
49
82
50
83
declare module 'js-yaml' {
0 commit comments