Skip to content

Commit 0475789

Browse files
committed
Fix props type (might be undefined)
1 parent a6dda7b commit 0475789

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

src/expo.ts

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@ import { dedent } from "ts-dedent";
77
import { Manifest } from ".";
88
import { cleanIOSAssets, getExpoConfig, hfs } from "./generate";
99

10-
type ExpoPlugin = Expo.ConfigPlugin<{
10+
type Props = {
1111
assetsDir?: string;
1212
android?: {
1313
parentTheme?: "TransparentStatus" | "EdgeToEdge";
1414
darkContentBarsStyle?: boolean;
1515
};
16-
}>;
16+
};
1717

1818
const withExpoVersionCheck =
19-
(platform: "android" | "ios"): ExpoPlugin =>
19+
(platform: "android" | "ios"): Expo.ConfigPlugin<Props> =>
2020
(config) =>
2121
Expo.withDangerousMod(config, [
2222
platform,
@@ -26,7 +26,7 @@ const withExpoVersionCheck =
2626
},
2727
]);
2828

29-
const withAndroidAssets: ExpoPlugin = (config, props) =>
29+
const withAndroidAssets: Expo.ConfigPlugin<Props> = (config, props) =>
3030
Expo.withDangerousMod(config, [
3131
"android",
3232
(config) => {
@@ -61,7 +61,7 @@ const withAndroidAssets: ExpoPlugin = (config, props) =>
6161
},
6262
]);
6363

64-
const withAndroidManifest: ExpoPlugin = (config) =>
64+
const withAndroidManifest: Expo.ConfigPlugin<Props> = (config) =>
6565
Expo.withAndroidManifest(config, (config) => {
6666
config.modResults.manifest.application?.forEach((application) => {
6767
if (application.$["android:name"] === ".MainApplication") {
@@ -78,7 +78,7 @@ const withAndroidManifest: ExpoPlugin = (config) =>
7878
return config;
7979
});
8080

81-
const withMainActivity: ExpoPlugin = (config) =>
81+
const withMainActivity: Expo.ConfigPlugin<Props> = (config) =>
8282
Expo.withMainActivity(config, (config) => {
8383
const { modResults } = config;
8484
const { language } = modResults;
@@ -113,7 +113,7 @@ const withMainActivity: ExpoPlugin = (config) =>
113113
};
114114
});
115115

116-
const withAndroidStyles: ExpoPlugin = (config, props) =>
116+
const withAndroidStyles: Expo.ConfigPlugin<Props> = (config, props) =>
117117
Expo.withAndroidStyles(config, async (config) => {
118118
const { assetsDir = "assets/bootsplash", android = {} } = props;
119119
const { parentTheme, darkContentBarsStyle } = android;
@@ -182,7 +182,7 @@ const withAndroidStyles: ExpoPlugin = (config, props) =>
182182
};
183183
});
184184

185-
const withAndroidColors: ExpoPlugin = (config, props) =>
185+
const withAndroidColors: Expo.ConfigPlugin<Props> = (config, props) =>
186186
Expo.withAndroidColors(config, async (config) => {
187187
const { assetsDir = "assets/bootsplash" } = props;
188188
const { projectRoot } = config.modRequest;
@@ -199,7 +199,7 @@ const withAndroidColors: ExpoPlugin = (config, props) =>
199199
return config;
200200
});
201201

202-
const withAndroidColorsNight: ExpoPlugin = (config, props) =>
202+
const withAndroidColorsNight: Expo.ConfigPlugin<Props> = (config, props) =>
203203
Expo.withAndroidColorsNight(config, async (config) => {
204204
const { assetsDir = "assets/bootsplash" } = props;
205205
const { projectRoot } = config.modRequest;
@@ -218,7 +218,7 @@ const withAndroidColorsNight: ExpoPlugin = (config, props) =>
218218
return config;
219219
});
220220

221-
const withIOSAssets: ExpoPlugin = (config, props) =>
221+
const withIOSAssets: Expo.ConfigPlugin<Props> = (config, props) =>
222222
Expo.withDangerousMod(config, [
223223
"ios",
224224
(config) => {
@@ -258,7 +258,7 @@ const withIOSAssets: ExpoPlugin = (config, props) =>
258258
},
259259
]);
260260

261-
const withAppDelegate: ExpoPlugin = (config) =>
261+
const withAppDelegate: Expo.ConfigPlugin<Props> = (config) =>
262262
Expo.withAppDelegate(config, (config) => {
263263
const { modResults } = config;
264264
const { language } = modResults;
@@ -301,13 +301,13 @@ const withAppDelegate: ExpoPlugin = (config) =>
301301
};
302302
});
303303

304-
const withInfoPlist: ExpoPlugin = (config) =>
304+
const withInfoPlist: Expo.ConfigPlugin<Props> = (config) =>
305305
Expo.withInfoPlist(config, (config) => {
306306
config.modResults["UILaunchStoryboardName"] = "BootSplash";
307307
return config;
308308
});
309309

310-
const withXcodeProject: ExpoPlugin = (config) =>
310+
const withXcodeProject: Expo.ConfigPlugin<Props> = (config) =>
311311
Expo.withXcodeProject(config, (config) => {
312312
const { projectName = "" } = config.modRequest;
313313

@@ -328,14 +328,14 @@ const withXcodeProject: ExpoPlugin = (config) =>
328328
return config;
329329
});
330330

331-
const withoutExpoSplashScreen: ExpoPlugin = Expo.createRunOncePlugin(
332-
(config) => config,
333-
"expo-splash-screen",
334-
"skip",
335-
);
331+
const withoutExpoSplashScreen: Expo.ConfigPlugin<Props> =
332+
Expo.createRunOncePlugin((config) => config, "expo-splash-screen", "skip");
336333

337-
export const withBootSplash: ExpoPlugin = (config, props = {}) => {
338-
const plugins: ExpoPlugin[] = [];
334+
export const withBootSplash: Expo.ConfigPlugin<Props | undefined> = (
335+
config,
336+
props = {},
337+
) => {
338+
const plugins: Expo.ConfigPlugin<Props>[] = [];
339339
const { platforms = [] } = config;
340340

341341
plugins.push(withoutExpoSplashScreen);

0 commit comments

Comments
 (0)