Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed an issue with types for usePropsFor #5723

Merged
merged 2 commits into from
Mar 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"type": "patch",
"area": "improvement",
"workstream": "",
"comment": "Fix returned types for useChatPropsFor and useCallingPropsFor",
"packageName": "@azure/communication-react",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"type": "patch",
"area": "improvement",
"workstream": "",
"comment": "Fix returned types for useChatPropsFor and useCallingPropsFor",
"packageName": "@azure/communication-react",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
Expand Up @@ -5495,13 +5495,13 @@ export const useCallAgent: () => CallAgent | undefined;
export const useCallClient: () => StatefulCallClient;

// @public
export const useCallingPropsFor: <Component extends (props: any) => JSX.Element>(component: Component) => ComponentProps<Component>;
export const useCallingPropsFor: <Component extends (props: any) => JSX.Element>(component: Component) => CallingReturnProps<Component>;

// @public
export const useChatClient: () => StatefulChatClient;

// @public
export const useChatPropsFor: <Component extends (props: any) => JSX.Element>(component: Component) => ComponentProps<Component>;
export const useChatPropsFor: <Component extends (props: any) => JSX.Element>(component: Component) => ChatReturnProps<Component>;

// @public
export const useChatThreadClient: () => ChatThreadClient;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4744,13 +4744,13 @@ export const useCallAgent: () => CallAgent | undefined;
export const useCallClient: () => StatefulCallClient;

// @public
export const useCallingPropsFor: <Component extends (props: any) => JSX.Element>(component: Component) => ComponentProps<Component>;
export const useCallingPropsFor: <Component extends (props: any) => JSX.Element>(component: Component) => CallingReturnProps<Component>;

// @public
export const useChatClient: () => StatefulChatClient;

// @public
export const useChatPropsFor: <Component extends (props: any) => JSX.Element>(component: Component) => ComponentProps<Component>;
export const useChatPropsFor: <Component extends (props: any) => JSX.Element>(component: Component) => ChatReturnProps<Component>;

// @public
export const useChatThreadClient: () => ChatThreadClient;
Expand Down
8 changes: 4 additions & 4 deletions packages/communication-react/src/mergedHooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,14 +159,14 @@ export const usePropsFor = <Component extends (props: any) => JSX.Element>(
*/
export const useChatPropsFor = <Component extends (props: any) => JSX.Element>(
component: Component
): ComponentProps<Component> => {
): ChatReturnProps<Component> => {
const props = useChatPropsForInternal(component);
if (props === undefined) {
throw new Error(
'Could not find props for this component, ensure the component is wrapped by appropriate providers.'
);
}
return props as ComponentProps<Component>;
return props as ChatReturnProps<Component>;
};

/**
Expand All @@ -178,12 +178,12 @@ export const useChatPropsFor = <Component extends (props: any) => JSX.Element>(
*/
export const useCallingPropsFor = <Component extends (props: any) => JSX.Element>(
component: Component
): ComponentProps<Component> => {
): CallingReturnProps<Component> => {
const props = useCallingPropsForInternal(component);
if (props === undefined) {
throw new Error(
'Could not find props for this component, ensure the component is wrapped by appropriate providers.'
);
}
return props as ComponentProps<Component>;
return props as CallingReturnProps<Component>;
};