@types/djv
TypeScript icon, indicating that this package has built-in type declarations

2.1.4 • Public • Published

Installation

npm install --save @types/djv

Summary

This package contains type definitions for djv (https://github.com/korzio/djv#readme).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/djv.

index.d.ts

interface DjvStatic {
    (options?: DjvStatic.DjvConfig): DjvStatic.djv;
    new(options?: DjvStatic.DjvConfig): DjvStatic.djv;
    expression(strings: string[], ...keys: string[]): (...values: string[]) => string;
}

declare namespace DjvStatic {
    interface DjvConfig {
        /** a handler to use for generating custom error messages */
        errorHandler?: (() => void) | undefined;
        /** an object containing list of formatters to add for environment */
        formats?: Record<string, (...values: string[]) => string> | undefined;
        /**
         * generating object should be considered as inner
         *
         * Default value is `false`/`undefined`. If `true`, then it avoid creating variables in a
         * generated function body, however without proper wrapper function approach will not work.
         */
        inner?: boolean | undefined;
        /** defines which version of json-schema draft to use, draft-04 by default */
        version?: string | undefined;
        /** handler to apply for environment version */
        versionConfigure?: ((object: object) => void) | undefined;
    }

    interface Resolved {
        schema: object;
        fn: (...args: any[]) => any;
    }

    interface djv {
        resolved: Resolved;

        addFormat(name: string, formatter: string | ((schema: object, tpl: any) => void)): void;

        addSchema(nameOrSchema: string | object, schema?: object): Resolved;

        export(name?: string): string;
        import(config: object): void;
        removeSchema(name: string): void;
        resolve(name: string | object): Resolved;
        setErrorHandler(errorHandler: (errorType: string, property: any) => string): void;
        useVersion(version: string, configure?: any): void;
        validate(name: string, object: object): string | undefined;
    }
}

declare const DjvStatic: DjvStatic;

export = DjvStatic;

Additional Details

  • Last updated: Mon, 06 Nov 2023 22:41:05 GMT
  • Dependencies: none

Credits

These definitions were written by Florian Keller.

Readme

Keywords

none

Package Sidebar

Install

npm i @types/djv

Weekly Downloads

53

Version

2.1.4

License

MIT

Unpacked Size

6.3 kB

Total Files

5

Last publish

Collaborators

  • types