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

2.0.5 • Public • Published

Installation

npm install --save @types/yayson

Summary

This package contains type definitions for yayson (https://github.com/confetti/yayson).

Details

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

index.d.ts

declare module "yayson" {
    class Store {
        sync(obj: {}): any;
        find(type: string, id: string): any;
        findAll(type: string): any[];
        remove(type: string, id?: string): void;
        reset(): void;

        records: y.Record[];
        relations: { [key: string]: any };
    }

    interface Adapter {
        get(model: {}, key?: string): any;
        id(model: {}): string;
    }

    class Presenter {
        static adapter: string;

        static render<T>(instanceOrCollection: PromiseLike<T>, options?: y.JsonOptions): PromiseLike<T>;
        static render(instanceOrCollection: {}, options?: y.JsonOptions): any;
        static toJSON(instanceOrCollection: {}, options?: y.JsonOptions): any;

        render<T>(instanceOrCollection: PromiseLike<T>, options?: y.JsonOptions): PromiseLike<T>;
        render(instanceOrCollection: {}, options?: y.JsonOptions): any;
        toJSON(instanceOrCollection: {}, options?: y.JsonOptions): any;
        id(instance: {}): string;

        type: string;
    }

    interface Yayson {
        Store: typeof Store;
        Presenter: typeof Presenter;
        Adapter: Adapter;
    }

    interface YaysonOptions {
        adapter?: "default" | "sequelize" | undefined;
    }

    function y(arg?: YaysonOptions): Yayson;

    namespace y {
        interface JsonOptions {
            [key: string]: any;
            meta?: {} | undefined;
        }
        interface Record {
            id: any;
            type: string;
            attributes: any;
            relationships: any;
        }
    }

    export = y;
}

Additional Details

  • Last updated: Tue, 07 Nov 2023 15:11:36 GMT
  • Dependencies: none

Credits

These definitions were written by David Wood.

Readme

Keywords

none

Package Sidebar

Install

npm i @types/yayson

Weekly Downloads

1,701

Version

2.0.5

License

MIT

Unpacked Size

5.7 kB

Total Files

5

Last publish

Collaborators

  • types