Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
bgawkuc committed May 28, 2024
1 parent 238abd6 commit 9fc260d
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 13 deletions.
9 changes: 6 additions & 3 deletions .storybook/webpack.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
/* eslint-disable no-param-reassign */

/* eslint-disable @typescript-eslint/naming-convention */
import type Environment from 'config/webpack/types';
import dotenv from 'dotenv';
import path from 'path';
import {DefinePlugin} from 'webpack';
Expand All @@ -18,6 +19,8 @@ type CustomWebpackConfig = {
};
};

type CustomWebpackFunctionProps = ({file, platform}: Environment) => CustomWebpackConfig;

let envFile: string;
switch (process.env.ENV) {
case 'production':
Expand All @@ -31,9 +34,9 @@ switch (process.env.ENV) {
}

const env = dotenv.config({path: path.resolve(__dirname, `../${envFile}`)});
const custom: CustomWebpackConfig = require('../config/webpack/webpack.common').default({
envFile,
});
const customFunction: CustomWebpackFunctionProps = require('../config/webpack/webpack.common');

const custom: CustomWebpackConfig = customFunction({file: envFile});

const webpackConfig = ({config}: {config: Configuration}) => {
if (!config.resolve) {
Expand Down
3 changes: 2 additions & 1 deletion config/webpack/webpack.common.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type WebpackPlugin from '@vue/preload-webpack-plugin';
import {CleanWebpackPlugin} from 'clean-webpack-plugin';
import CopyPlugin from 'copy-webpack-plugin';
import dotenv from 'dotenv';
Expand All @@ -11,7 +12,7 @@ import CustomVersionFilePlugin from './CustomVersionFilePlugin';
import type Environment from './types';

// 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.
const PreloadWebpackPlugin = require('@vue/preload-webpack-plugin');
const PreloadWebpackPlugin: typeof WebpackPlugin = require('@vue/preload-webpack-plugin');

const includeModules = [
'react-native-animatable',
Expand Down
3 changes: 2 additions & 1 deletion src/components/Tooltip/BaseTooltip/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,8 @@ function Tooltip(
(e: MouseEvent) => {
updateTargetAndMousePosition(e);
if (React.isValidElement(children)) {
children.props.onMouseEnter?.(e);
const onMouseEnter: (e: MouseEvent) => void | undefined = children.props.onMouseEnter;
onMouseEnter?.(e);
}
},
[children, updateTargetAndMousePosition],
Expand Down
2 changes: 1 addition & 1 deletion src/components/WalletStatementModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function WalletStatementModal({statementPageURL, session}: WalletStatementProps)
/**
* Handles in-app navigation for iframe links
*/
const navigate = (event: MessageEvent) => {
const navigate = (event: MessageEvent<{url: string; type: string}>) => {
if (!event.data?.type || (event.data.type !== CONST.WALLET.WEB_MESSAGE_TYPE.STATEMENT && event.data.type !== CONST.WALLET.WEB_MESSAGE_TYPE.CONCIERGE)) {
return;
}
Expand Down
2 changes: 1 addition & 1 deletion src/libs/Environment/betaChecker/index.android.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as AppUpdate from '@libs/actions/AppUpdate';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import pkg from '../../../../package.json';
import type IsBetaBuild from './types';
import type {IsBetaBuild} from './types';

let isLastSavedBeta = false;
Onyx.connect({
Expand Down
5 changes: 3 additions & 2 deletions src/libs/Environment/betaChecker/index.ios.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import {NativeModules} from 'react-native';
import type IsBetaBuild from './types';
import type {EnvironmentCheckerProps, IsBetaBuild} from './types';

/**
* Check to see if the build is staging (TestFlight) or production
*/
function isBetaBuild(): IsBetaBuild {
return new Promise((resolve) => {
NativeModules.EnvironmentChecker.isBeta().then((isBeta: boolean) => {
const {EnvironmentChecker} = NativeModules;
(EnvironmentChecker as EnvironmentCheckerProps).isBeta().then((isBeta: boolean) => {
resolve(isBeta);
});
});
Expand Down
2 changes: 1 addition & 1 deletion src/libs/Environment/betaChecker/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type IsBetaBuild from './types';
import type {IsBetaBuild} from './types';

/**
* There's no beta build in non native
Expand Down
6 changes: 5 additions & 1 deletion src/libs/Environment/betaChecker/types.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
type IsBetaBuild = Promise<boolean>;

export default IsBetaBuild;
type EnvironmentCheckerProps = {
isBeta: () => IsBetaBuild;
};

export type {IsBetaBuild, EnvironmentCheckerProps};
3 changes: 1 addition & 2 deletions src/libs/StartupTimer/index.native.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ import type StartupTimer from './types';
*/
const startupTimer: StartupTimer = {
stop: () => {
const {StartupTimer} = NativeModules;
(StartupTimer as StartupTimer).stop();
(NativeModules.StartupTimer as StartupTimer).stop();
},
};

Expand Down

0 comments on commit 9fc260d

Please sign in to comment.