vitalets / google-translate-api

A free and unlimited API for Google Translate :dollar: :no_entry_sign:
MIT License
936 stars 120 forks source link

Update type definition #86

Closed ciiiii closed 2 years ago

ciiiii commented 2 years ago

Type definition should sync with the code implementation.

perklet commented 2 years ago

The tld options is missing in type definitions, please add it.

src/translate.ts:6:66 - error TS2345: Argument of type '{ from: string; to: string; tld: string; }' is not assignable to parameter of type 'IOptions'.
  Object literal may only specify known properties, and 'tld' does not exist in type 'IOptions'.

6   const res = await translate(english, {from: 'en', to: 'zh-CN', tld: 'cn'})
                                                                   ~~~~~~~~~

Found 1 error.
vitalets commented 2 years ago

I've released 8.0.0 with fixed types. Now everything should be correct - tld is just string.

Feel free to reopen if needed.