# TypeScript usage

The library is written in typescript so you can easily use its types

Any [model](models) is a class that you can use in your code as a type

For example

```typescript
import { EnkaNetwork, FetchUserUID } from "enkanetwork";

const enka = new EnkaNetwork({ language: "EN", assets: { languages: ["RU"] } });

enka.setLanguage("RU").fetchUser(700832641).then(someFunction);

function someFunction(data: FetchUserUID) {
    
}

```

<figure><img src="https://129309102-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHRuRVaMzLuUsL0mMhv72%2Fuploads%2FEHOzl1LT5XaD5fqgzGBK%2Fimage.png?alt=media&#x26;token=6844749a-5785-43b9-a9fa-6dea96a71341" alt=""><figcaption></figcaption></figure>

or more deeper&#x20;

```typescript
import { Character, EnkaNetwork } from "enkanetwork";

const enka = new EnkaNetwork({ language: "EN", assets: { languages: ["RU"] } });

enka.setLanguage("RU")
    .fetchUser(700832641)
    .then((user) =>
        user.characters.forEach((character) => someFunction(character))
    );

function someFunction(character: Character) {

}

```

<figure><img src="https://129309102-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHRuRVaMzLuUsL0mMhv72%2Fuploads%2FSaLLOS1SDDmPHcz9qLvX%2Fimage.png?alt=media&#x26;token=d1de91c5-86cf-4d4b-8b8e-864680ddc7a1" alt=""><figcaption></figcaption></figure>
