# @types/kos-core

> TypeScript definitions for kos-core

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

## Install

```sh
npm install @types/kos-core
pnpm add @types/kos-core
yarn add @types/kos-core
bun add @types/kos-core
```

## 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; pre 1.0.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 0.6.4 |
| Published | 2023-11-07 |
| First published | 2018-10-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 6.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 51442 |
| Maintainers | types |

## Links

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

## Dependencies (1)

- [@types/react](https://npm.io/package/@types/react.md) *

## Recent versions

- 0.6.4 (latest) — 2023-11-07
- 0.6.1 (ts3.6) — 2021-07-08
- 0.6.0 (ts3.4) — 2019-05-28
- 0.4.1 (ts2.8) — 2019-04-18
- 0.6.3 — 2023-10-18
- 0.6.2 — 2023-09-14
- 0.4.0 — 2018-11-18
- 0.3.0 — 2018-10-17

## README

# Installation
> `npm install --save @types/kos-core`

# Summary
This package contains type definitions for kos-core (https://github.com/ali-Kos/Kos).

# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/kos-core.
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/kos-core/index.d.ts)
````ts
import * as React from "react";

type ReactComponent<P = any, S = any> = React.ComponentClass<P, S>;

interface Util {
    getActionType: (action: string) => { namespace: string | null; type: string };
    getParam: () => any;
}

interface WrapperConfig {
    model: KosModel;
    autoLoad?: boolean | undefined;
    autoReset?: boolean | undefined;
    namespace?: string | undefined;
}

interface Action<T = any> {
    type: string;
    payload?: Partial<T> & { [x: string]: any } | undefined;
}

export interface KosProps<T = any> {
    dispatch?: ((action: Action<T>) => void) | undefined;
    getParam?: (() => any) | undefined;
    getNamespace?: (() => string) | undefined;
}

export type KosDispatch = (action: Action) => void;

export type GetKosState<T = any> = () => T;

export interface KosModel<T = any> {
    namespace: string;
    initial: T;
    reducers: {
        [key: string]: (state: T, { payload }: { payload: T }) => void;
    };
    asyncs: {
        [key: string]: (dispatch?: KosDispatch, getState?: GetKosState<T>, action?: { payload: T }) => void;
    };
    setup?:
        | ((dispatch: KosDispatch, getState: GetKosState<T>, action: { payload: { param: any } }) => void)
        | undefined;
    getAsync?:
        | ((
            key: string,
        ) => (dispatch: KosDispatch, getState?: GetKosState) => void)
        | undefined;
}

interface Kos {
    Util: Util;
    registeModel: (model: any) => void;
    removeModel: (namespace: string) => void;
    getModel: (namespace: string) => KosModel;
    use: (middleware: (api: { dispatch: any; getState: any }) => void) => void;
    Wrapper: (
        config: WrapperConfig,
    ) => (component: ReactComponent<any & KosProps>) => any;
    start: (Layout: ReactComponent, container?: string) => void;
}

declare let KOS: Kos;
export default KOS;

````

### Additional Details
 * Last updated: Tue, 07 Nov 2023 09:09:38 GMT
 * Dependencies: [@types/react](https://npmjs.com/package/@types/react)

# Credits
These definitions were written by [alibaba ali-Kos](https://github.com/ali-Kos).

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