kimxogus / react-native-version-check

A version checker for react-native applications
MIT License
715 stars 171 forks source link

Typescript error VersionCheck.getLatestVersion #201

Closed buscanopaul closed 1 year ago

buscanopaul commented 1 year ago

Hi,

I have this error with typescript with provider

VersionCheck.getLatestVersion({ provider: () => fetch('http://your.own/api') .then(r => r.json()) .then(({version}) => version), // You can get latest version from your own api. }).then(latestVersion =>{ console.log(latestVersion); });

It says Type '() => Promise' is not assignable to type 'string | (() => string) | undefined'. Type '() => Promise' is not assignable to type '() => string'. Type 'Promise' is not assignable to type 'string'.

BraveEvidence commented 1 year ago

This will help https://www.youtube.com/watch?v=q3-Mrwd1Vm0