• Version 4.0.1
  • Published
  • 8.46 kB
  • No dependencies
  • MIT license


npm i @types/js-yaml
yarn add @types/js-yaml
pnpm add @types/js-yaml


TypeScript definitions for js-yaml



variable CORE_SCHEMA

let CORE_SCHEMA: Schema;
  • same as JSON_SCHEMA: http://www.yaml.org/spec/1.2/spec.html#id2804923


  • all supported YAML types


  • only strings, arrays and plain objects: http://www.yaml.org/spec/1.2/spec.html#id2802346

variable JSON_SCHEMA

let JSON_SCHEMA: Schema;
  • only strings, arrays and plain objects: http://www.yaml.org/spec/1.2/spec.html#id2802346


function dump

dump: (obj: any, opts?: DumpOptions) => string;

    function load

    load: (
    str: string,
    opts?: LoadOptions
    ) => object | string | number | null | undefined;

      function loadAll

      loadAll: {
      (str: string, iterator?: null, opts?: LoadOptions): any[];
      (str: string, iterator: (doc: any) => void, opts?: LoadOptions): void;


        class Schema

        class Schema {}


          constructor(definition: SchemaDefinition | Type | Type[]);

            method extend

            extend: (types: SchemaDefinition | Type[] | Type) => Schema;

              class Type

              class Type {}


                constructor(tag: string, opts?: TypeConstructorOptions);

                  property defaultStyle

                  defaultStyle: string;

                    property instanceOf

                    instanceOf: {};

                      property kind

                      kind: 'sequence' | 'scalar' | 'mapping';

                        property multi

                        multi: boolean;

                          property predicate

                          predicate: (data: object) => boolean;

                            property represent

                            represent: ((data: object) => any) | { [x: string]: (data: object) => any };

                              property representName

                              representName: (data: object) => any;

                                property styleAliases

                                styleAliases: { [x: string]: any };

                                  method construct

                                  construct: (data: any, type?: string) => any;

                                    method resolve

                                    resolve: (data: any) => boolean;

                                      class YAMLException

                                      class YAMLException extends Error {}


                                        constructor(reason?: any, mark?: any);

                                          method toString

                                          toString: (compact?: boolean) => string;


                                            interface DumpOptions

                                            interface DumpOptions {}

                                              property condenseFlow

                                              condenseFlow?: boolean;
                                              • if true flow sequences will be condensed, omitting the space between key: value or a, b. Eg. '[a,b]' or {a:{b:c}}. Can be useful when using yaml for pretty URL query params as spaces are %-encoded. (default: false).

                                              property flowLevel

                                              flowLevel?: number;
                                              • specifies level of nesting, when to switch from block to flow style for collections. -1 means block style everwhere

                                              property forceQuotes

                                              forceQuotes?: boolean;
                                              • if true, all non-key strings will be quoted even if they normally don't need to. (default: false)

                                              property indent

                                              indent?: number;
                                              • indentation width to use (in spaces).

                                              property lineWidth

                                              lineWidth?: number;
                                              • set max line width. (default: 80)

                                              property noArrayIndent

                                              noArrayIndent?: boolean;
                                              • when true, will not add an indentation level to array elements

                                              property noCompatMode

                                              noCompatMode?: boolean;
                                              • if true don't try to be compatible with older yaml versions. Currently: don't quote "yes", "no" and so on, as required for YAML 1.1 (default: false)

                                              property noRefs

                                              noRefs?: boolean;
                                              • if true, don't convert duplicate objects into references (default: false)

                                              property quotingType

                                              quotingType?: "'" | '"';
                                              • strings will be quoted using this quoting style. If you specify single quotes, double quotes will still be used for non-printable characters. (default: ')

                                              property replacer

                                              replacer?: (key: string, value: any) => any;
                                              • callback function (key, value) called recursively on each key/value in source object (see replacer docs for JSON.stringify).

                                              property schema

                                              schema?: Schema;
                                              • specifies a schema to use.

                                              property skipInvalid

                                              skipInvalid?: boolean;
                                              • do not throw on invalid types (like function in the safe schema) and skip pairs and single values with such types.

                                              property sortKeys

                                              sortKeys?: boolean | ((a: any, b: any) => number);
                                              • if true, sort keys when dumping YAML. If a function, use the function to sort the keys. (default: false)

                                              property styles

                                              styles?: { [x: string]: any };
                                              • Each tag may have own set of styles. - "tag" => "style" map.

                                              interface LoadOptions

                                              interface LoadOptions {}

                                                property filename

                                                filename?: string;
                                                • string to be used as a file path in error/warning messages.

                                                property json

                                                json?: boolean;
                                                • compatibility with JSON.parse behaviour.

                                                property schema

                                                schema?: Schema;
                                                • specifies a schema to use.

                                                method listener

                                                listener: (this: State, eventType: EventType, state: State) => void;
                                                • listener for parse events

                                                method onWarning

                                                onWarning: (this: null, e: YAMLException) => void;
                                                • function to call on warning messages.

                                                interface SchemaDefinition

                                                interface SchemaDefinition {}

                                                  property explicit

                                                  explicit?: Type[];

                                                    property implicit

                                                    implicit?: Type[];

                                                      interface State

                                                      interface State {}

                                                        property checkLineBreaks

                                                        checkLineBreaks: boolean;

                                                          property filename

                                                          filename: string | null;

                                                            property implicitTypes

                                                            implicitTypes: Type[];

                                                              property input

                                                              input: string;

                                                                property json

                                                                json: boolean;

                                                                  property kind

                                                                  kind: string;

                                                                    property length

                                                                    length: number;

                                                                      property line

                                                                      line: number;

                                                                        property lineIndent

                                                                        lineIndent: number;

                                                                          property lineStart

                                                                          lineStart: number;

                                                                            property onWarning

                                                                            onWarning: (this: null, e: YAMLException) => void;

                                                                              property position

                                                                              position: number;

                                                                                property result

                                                                                result: any;

                                                                                  property schema

                                                                                  schema: Schema;

                                                                                    property version

                                                                                    version: null | number;

                                                                                      interface TypeConstructorOptions

                                                                                      interface TypeConstructorOptions {}

                                                                                        property construct

                                                                                        construct?: (data: any, type?: string) => any;

                                                                                          property defaultStyle

                                                                                          defaultStyle?: string;

                                                                                            property instanceOf

                                                                                            instanceOf?: object;

                                                                                              property kind

                                                                                              kind?: 'sequence' | 'scalar' | 'mapping';

                                                                                                property multi

                                                                                                multi?: boolean;

                                                                                                  property predicate

                                                                                                  predicate?: (data: object) => boolean;

                                                                                                    property represent

                                                                                                    represent?: ((data: object) => any) | { [x: string]: (data: object) => any };

                                                                                                      property representName

                                                                                                      representName?: (data: object) => any;

                                                                                                        property resolve

                                                                                                        resolve?: (data: any) => boolean;

                                                                                                          property styleAliases

                                                                                                          styleAliases?: { [x: string]: any };

                                                                                                            Type Aliases

                                                                                                            type EventType

                                                                                                            type EventType = 'open' | 'close';

                                                                                                              Package Files (1)

                                                                                                              Dependencies (0)

                                                                                                              No dependencies.

                                                                                                              Dev Dependencies (0)

                                                                                                              No dev dependencies.

                                                                                                              Peer Dependencies (0)

                                                                                                              No peer dependencies.


                                                                                                              To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                                                                                              You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@types/js-yaml.

                                                                                                              • Markdown
                                                                                                              • HTML
                                                                                                                <a href="https://www.jsdocs.io/package/@types/js-yaml"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>