# @types/yayson

> TypeScript definitions for yayson

Latest version **2.0.5** (published 2023-11-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install @types/yayson
pnpm add @types/yayson
yarn add @types/yayson
bun add @types/yayson
```

## Health

**Score 45/100 (D)** — status: abandoned.

Positive: has types; no vulnerabilities; high maintenance score; popular repo; extremely popular.

Warnings: low downloads; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 2.0.5 |
| Published | 2023-11-07 |
| First published | 2016-10-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 5.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 51470 |
| Maintainers | types |

## Links

- npm: https://www.npmjs.com/package/@types/yayson
- Repository: https://github.com/DefinitelyTyped/DefinitelyTyped
- Homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/yayson
- npm.io page: https://npm.io/package/@types/yayson

## Recent versions

- 2.0.5 (latest) — 2023-11-07
- 2.0.2 (ts3.6) — 2021-07-02
- 2.0.1 (ts2.0) — 2016-10-05
- 2.0.4 — 2023-10-18
- 2.0.3 — 2023-09-25

## README

# 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](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/yayson/index.d.ts)
````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](https://github.com/Codesleuth).

---
_Source: https://npm.io/package/@types/yayson · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
