Skip to content

Commit 89a8314

Browse files
Address typecheck errors
1 parent 13ce47b commit 89a8314

File tree

7 files changed

+20
-16
lines changed

7 files changed

+20
-16
lines changed

AgentforceSDK-ReactNative-Bridge/app/App.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ import { createNativeStackNavigator } from '@react-navigation/native-stack';
44
import HomeScreen from './screens/HomeScreen';
55
import SettingsScreen from './screens/SettingsScreen';
66

7-
type RootStackParamList = {
7+
export type RootStackParamList = {
88
Home: undefined;
9-
Settings: { tab?: 'service' | 'employee' } | undefined;
9+
Settings: { tab?: 'service' | 'employee' };
1010
};
1111

1212
const Stack = createNativeStackNavigator<RootStackParamList>();

AgentforceSDK-ReactNative-Bridge/app/screens/SettingsScreen.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ import {
1010
KeyboardAvoidingView,
1111
Platform,
1212
} from 'react-native';
13+
import type { NativeStackScreenProps } from '@react-navigation/native-stack';
14+
import type { RootStackParamList } from '../App';
1315
import {
1416
AgentforceService,
1517
isEmployeeAgentAuthSupported,
@@ -19,10 +21,7 @@ import {
1921
} from '../../src';
2022
// Employee Agent tab uses Mobile SDK login only; file-based config is a dev backdoor (no UI here).
2123

22-
interface SettingsScreenProps {
23-
navigation: any;
24-
route?: { params?: { tab?: 'service' | 'employee' } };
25-
}
24+
type SettingsScreenProps = NativeStackScreenProps<RootStackParamList, 'Settings'>;
2625

2726
type TabType = 'service' | 'employee';
2827

AgentforceSDK-ReactNative-Bridge/src/services/AgentforceService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ const EVENTS = {
4949
/**
5050
* Valid context variable types for runtime validation
5151
*/
52-
const VALID_CONTEXT_TYPES: Set<AgentforceContextVariableType> = new Set([
52+
const VALID_CONTEXT_TYPES: Set<AgentforceContextVariableType> = new Set<AgentforceContextVariableType>([
5353
'Text',
5454
'Number',
5555
'Boolean',

App.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ import HomeScreen from './src/screens/HomeScreen';
2929
import SettingsScreen from './src/screens/SettingsScreen';
3030
import FeatureFlagsScreen from './src/screens/FeatureFlagsScreen';
3131

32-
type RootStackParamList = {
32+
export type RootStackParamList = {
3333
Home: undefined;
34-
Settings: { tab?: 'service' | 'employee' | 'features' } | undefined;
34+
Settings: { tab?: 'service' | 'employee' | 'features' };
3535
FeatureFlags: undefined;
3636
};
3737

src/config/AppConfig.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,15 @@
3131

3232
import { APP_MODE } from './AppConfig.generated';
3333

34+
// Widen the type for comparison - APP_MODE can be 'service', 'employee', or 'all'
35+
const appMode: 'service' | 'employee' | 'all' = APP_MODE as any;
36+
3437
/**
3538
* Feature flags derived from APP_MODE
3639
*/
3740
export const FEATURES = {
38-
SHOW_SERVICE_AGENT: APP_MODE === 'all' || APP_MODE === 'service',
39-
SHOW_EMPLOYEE_AGENT: APP_MODE === 'all' || APP_MODE === 'employee',
41+
SHOW_SERVICE_AGENT: appMode === 'all' || appMode === 'service',
42+
SHOW_EMPLOYEE_AGENT: appMode === 'all' || appMode === 'employee',
4043
};
4144

4245
/**

src/screens/FeatureFlagsScreen.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44

55
import React, { useEffect } from 'react';
66
import type { NativeStackScreenProps } from '@react-navigation/native-stack';
7+
import type { RootStackParamList } from '../../App';
78

8-
type Props = NativeStackScreenProps<any, 'FeatureFlags'>;
9+
10+
type Props = NativeStackScreenProps<RootStackParamList, 'FeatureFlags'>;
911

1012
/**
1113
* Redirects to the Settings screen's Flags tab.

src/screens/SettingsScreen.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ import {
3636
Switch,
3737
ActivityIndicator,
3838
} from 'react-native';
39+
import type { NativeStackScreenProps } from '@react-navigation/native-stack';
40+
import type { RootStackParamList } from '../../App';
3941
import {
4042
AgentforceService,
4143
isEmployeeAgentAuthSupported,
@@ -72,10 +74,8 @@ const FLAG_HINTS: Record<keyof FeatureFlags, string> = {
7274
enableCustomViewProvider: 'Override SDK output views with React Native components',
7375
};
7476

75-
interface SettingsScreenProps {
76-
navigation: any;
77-
route?: { params?: { tab?: TabType } };
78-
}
77+
78+
type SettingsScreenProps = NativeStackScreenProps<RootStackParamList, 'Settings'>;
7979

8080
const SettingsScreen: React.FC<SettingsScreenProps> = ({ navigation, route }) => {
8181
const [activeTab, setActiveTab] = useState<TabType>(

0 commit comments

Comments
 (0)