diff --git a/types/react-native/index.d.ts b/types/react-native/index.d.ts index 69f012d038..b71afc7463 100644 --- a/types/react-native/index.d.ts +++ b/types/react-native/index.d.ts @@ -5322,8 +5322,8 @@ export interface SystraceStatic { export interface DataSourceAssetCallback { rowHasChanged?: (r1: any, r2: any) => boolean sectionHeaderHasChanged?: (h1: any, h2: any) => boolean - getRowData?: (dataBlob: any, sectionID: number | string, rowID: number | string) => T - getSectionHeaderData?: (dataBlob: any, sectionID: number | string) => T + getRowData?: (dataBlob: any, sectionID: number | string, rowID: number | string) => any + getSectionHeaderData?: (dataBlob: any, sectionID: number | string) => any } /** @@ -5383,7 +5383,7 @@ export interface ListViewDataSource { * handle merging of old and new data separately and then pass that into * this function as the `dataBlob`. */ - cloneWithRows(dataBlob: Array | { [key: string]: any }, rowIdentities?: Array): ListViewDataSource + cloneWithRows(dataBlob: Array | { [key: string]: any }, rowIdentities?: Array): ListViewDataSource /** * This performs the same function as the `cloneWithRows` function but here @@ -5631,7 +5631,7 @@ interface PlatformStatic { interface DeviceEventEmitterStatic extends EventEmitter { sharedSubscriber: EventSubscriptionVendor new(): DeviceEventEmitterStatic; - addListener( type: string, listener: ( data: T ) => void, context?: any ): EmitterSubscription; + addListener( type: string, listener: ( data: any ) => void, context?: any ): EmitterSubscription; } // Used by Dimensions below diff --git a/types/react-native/test/index.tsx b/types/react-native/test/index.tsx index 9771db9bc9..15f86af6c3 100644 --- a/types/react-native/test/index.tsx +++ b/types/react-native/test/index.tsx @@ -18,6 +18,8 @@ import { AppStateIOS, BackAndroid, Button, + DataSourceAssetCallback, + DeviceEventEmitterStatic, Dimensions, InteractionManager, ListView, @@ -369,3 +371,18 @@ class MaskedViewTest extends React.Component { ) } } + +// DataSourceAssetCallback +const dataSourceAssetCallback1: DataSourceAssetCallback = { + rowHasChanged: (r1, r2) => true, + sectionHeaderHasChanged: (h1, h2) => true, + getRowData: (dataBlob, sectionID, rowID) => (sectionID as number) + (rowID as number), + getSectionHeaderData: (dataBlob, sectionID) => sectionID as string, +} + +const dataSourceAssetCallback2: DataSourceAssetCallback = {} + +// DeviceEventEmitterStatic +const deviceEventEmitterStatic: DeviceEventEmitterStatic = null; +deviceEventEmitterStatic.addListener('keyboardWillShow', (data) => true); +deviceEventEmitterStatic.addListener('keyboardWillShow', (data) => true, {});