Skip to content

Commit 733cd35

Browse files
emlynmacMohtasim
authored andcommitted
Enable noImplicitAny in chat-stateful-client (#3998)
1 parent 83c7a48 commit 733cd35

6 files changed

Lines changed: 29 additions & 7 deletions
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"type": "patch",
3+
"area": "fix",
4+
"workstream": "noImplicitAny fixes",
5+
"comment": "Enable noImplicitAny in chat-component-bindings",
6+
"packageName": "@azure/communication-react",
7+
"email": "3941071+emlynmac@users.noreply.github.com",
8+
"dependentChangeType": "patch"
9+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"type": "patch",
3+
"area": "fix",
4+
"workstream": "noImplicitAny fixes",
5+
"comment": "Enable noImplicitAny in chat-component-bindings",
6+
"packageName": "@azure/communication-react",
7+
"email": "3941071+emlynmac@users.noreply.github.com",
8+
"dependentChangeType": "patch"
9+
}

packages/chat-component-bindings/src/errorBarSelector.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,13 +95,15 @@ const accessErrorTargets: ChatErrorTarget[] = [
9595

9696
const latestUnableToReachChatServiceError = (latestErrors: ChatErrors): ActiveErrorMessage | undefined => {
9797
return latestActiveErrorSatisfying(latestErrors, 'unableToReachChatService', (error: ChatError): boolean => {
98-
return !!error && !!error.innerError && error.innerError['code'] === 'REQUEST_SEND_ERROR';
98+
return (
99+
!!error && !!error.innerError && 'code' in error.innerError && error.innerError.code === 'REQUEST_SEND_ERROR'
100+
);
99101
});
100102
};
101103

102104
const latestAccessDeniedError = (latestErrors: ChatErrors): ActiveErrorMessage | undefined => {
103105
return latestActiveErrorSatisfying(latestErrors, 'accessDenied', (error: ChatError): boolean => {
104-
return !!error && !!error.innerError && error.innerError['statusCode'] === 401;
106+
return !!error && !!error.innerError && 'statusCode' in error.innerError && error.innerError.statusCode === 401;
105107
});
106108
};
107109

@@ -121,13 +123,16 @@ const latestNotInThisThreadError = (latestErrors: ChatErrors): ActiveErrorMessag
121123

122124
// Chat service returns 403 if a user has been removed from a thread.
123125
// Chat service returns either 400 or 404 if the thread ID is malformed, depending on how the thread ID is malformed.
124-
return [400, 403, 404].some((statusCode) => error.innerError['statusCode'] === statusCode);
126+
return [400, 403, 404].some(
127+
(statusCode) => 'statusCode' in error.innerError && error.innerError.statusCode === statusCode
128+
);
125129
});
126130
};
127131

128132
const botContactMRIPrefix = '28:';
129133
const isErrorDueToBotContact = (error: ChatError): boolean =>
130-
error.innerError['statusCode'] === 400 &&
134+
'statusCode' in error.innerError &&
135+
error.innerError.statusCode === 400 &&
131136
error.innerError.message.includes(`Identifier format is not supported (${botContactMRIPrefix}`);
132137

133138
const latestActiveErrorSatisfying = (

packages/chat-component-bindings/src/hooks/usePropsFor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ export const getSelector = <Component extends (props: any) => JSX.Element | unde
8080
return findSelector(component);
8181
};
8282

83-
const messageThreadSelectorsByThread = {};
83+
const messageThreadSelectorsByThread: { [key: string]: MessageThreadSelector } = {};
8484

8585
const findSelector = (component: (props: any) => JSX.Element | undefined): any => {
8686
// For the message thread selector we need to create a new one for each thread

packages/chat-component-bindings/src/typingIndicatorSelector.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ describe('typingIndicatorSelector tests', () => {
206206
receivedOn: new Date()
207207
}
208208
];
209-
const participants = {};
209+
const participants: { [key: number]: { id: string; displayName: string } } = {};
210210
Array.from(Array(20).keys()).forEach(
211211
(num) => (participants[`${num}`] = { id: `${num}`, displayName: `User${num}` })
212212
);

packages/chat-component-bindings/tsconfig.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
"extends": "../../common/config/tsc/tsconfig.json",
33
"compilerOptions": {
4-
"noImplicitAny": false, // TODO: MAKE THIS true
54
"outDir": "./dist/dist-esm"
65
},
76
"typeRoots": ["./node_modules/@types"],

0 commit comments

Comments
 (0)