MattPlays / AniAPI.js

A Javascript wrapper for aniapi
MIT License
18 stars 4 forks source link

Exporting types #4

Closed Artrix9095 closed 2 years ago

Artrix9095 commented 2 years ago

So Im trying to use this SDK in typescript... and i find it very difficult to make this library cooperate with type checking because I don't have the actual types for most of the api responses... example: image there's no real convenient way to check if I got an anime or not, or to at least make it type safe. if you were to export the types (such as the interface Anime in this scenario), doing something like

import { Anime } from '@mattplays/aniapi'

const res = await API.Anime.Random(10);

const data = res.data as Anime

Doing this could go a long way in making production level projects easier. Thanks!

MattPlays commented 2 years ago

@Artrix9095 In a fix Im about to release for this, hopefully you can do

import { API, Anime } from '@mattplays/aniapi'

const res = await API.Anime.Random(10);

const data = res.data as Anime