AidanWelch / google-translate-api

An updated free and unlimited API for Google Translate :dollar: :no_entry_sign:
MIT License
137 stars 19 forks source link

TypeScript Error #21

Closed d1ksim closed 1 year ago

d1ksim commented 1 year ago

TS2339: Property 'text' does not exist on type 'ITranslateResponse | ITranslateResponse[] | { [x: string]: ITranslateResponse; }'.   Property 'text' does not exist on type 'ITranslateResponse[]'.

I use React and TypeScript.

const translator = new Translator({from: 'en', to: 'es', forceBatch: false, tld: 'es'}); const res = await translator.translate('Ik spreek Engels', {to: user_data!.lang}); console.log(res.text)

AidanWelch commented 1 year ago

Typescript definitions are outdated, I will try to update soon but have been busy

AidanWelch commented 1 year ago

Fixed in 5ddcc045e185c2c32c49f2fe353832a96efd8175