Removes the header at the top as that's only required for definitions hosted on DefinitelyTyped. Forgot to remove this when I ported the definitions.
Fixed the definitions to work correctly. The attempt in #111 was good but it does an incorrect export at https://github.com/cooperka/react-native-snackbar/blob/master/src/index.d.ts#L92. This allows import { Snackbar } from 'react-native-snackbar' which is incorrect. Instead it the const should be declared and default exported.
Lastly adds a typescript test that'll test definitions in ci so we don’t have these problems going forward.
Thank you for the continued help @iRoachie! Looks fine to me, though I'm trusting you since I don't have much TS experience 😉 Will release as 1.0.2 and also 2.0.1
Motivation
Reduce the issues and long discussions around types in https://github.com/cooperka/react-native-snackbar/pull/111 https://github.com/cooperka/react-native-snackbar/pull/106
Solution
Some small housekeeping on different areas:
Exports all interfaces used https://github.com/cooperka/react-native-snackbar/pull/111#issuecomment-509549617. This is best practice in the industry. As a result, renamed the
Action
interface toSnackbarAction
so it reflects where it's from. Also renamesSnackbar
toSnackbarStatic
which is the naming convention (See React Native's Alert for example https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/react-native/index.d.ts#L7011).Removes the header at the top as that's only required for definitions hosted on DefinitelyTyped. Forgot to remove this when I ported the definitions.
Fixed the definitions to work correctly. The attempt in #111 was good but it does an incorrect export at https://github.com/cooperka/react-native-snackbar/blob/master/src/index.d.ts#L92. This allows
import { Snackbar } from 'react-native-snackbar'
which is incorrect. Instead it the const should be declared and default exported.Lastly adds a typescript test that'll test definitions in ci so we don’t have these problems going forward.