Skip to content

Commit 4f82ac1

Browse files
committed
use generic type with require
1 parent f4730ca commit 4f82ac1

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

__mocks__/react-native-webview.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import type {View as RNView} from 'react-native';
22

33
jest.mock('react-native-webview', () => {
4-
const {View} = require('react-native');
4+
const {View} = require<{View: RNView}>('react-native');
55
return {
6-
WebView: () => View as RNView,
6+
WebView: () => View,
77
};
88
});

config/webpack/webpack.common.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ type PreloadWebpackPluginClass = {
2424
};
2525

2626
// require is necessary, there are no types for this package and the declaration file can't be seen by the build process which causes an error.
27-
const PreloadWebpackPlugin: PreloadWebpackPluginClass = require('@vue/preload-webpack-plugin');
27+
const PreloadWebpackPlugin = require<PreloadWebpackPluginClass>('@vue/preload-webpack-plugin');
2828

2929
const includeModules = [
3030
'react-native-animatable',

src/libs/Performance.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ const Performance: PerformanceModule = {
9292
};
9393

9494
if (Metrics.canCapturePerformanceMetrics()) {
95-
const perfModule: ReactNativePerformance = require('react-native-performance');
95+
const perfModule = require<ReactNativePerformance>('react-native-performance');
9696
perfModule.setResourceLoggingEnabled(true);
9797
rnPerformance = perfModule.default;
9898

wdyr.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import Config from 'react-native-config';
66
const useWDYR = Config?.USE_WDYR === 'true';
77

88
if (useWDYR) {
9-
const whyDidYouRender: typeof WhyDidYouRender = require('@welldone-software/why-did-you-render');
9+
const whyDidYouRender = require<typeof WhyDidYouRender>('@welldone-software/why-did-you-render');
1010
whyDidYouRender(React, {
1111
// Enable tracking in all pure components by default
1212
trackAllPureComponents: true,

0 commit comments

Comments
 (0)