Usage of generics with httpsCallable functions #4415
Answered
by
Feiyang1
nthonymiller
asked this question in
Q&A
-
From the documentation the callable functions as per below: const functions = getFunctions(firebaseApp);
const addMessage = httpsCallable(functions, 'addMessage');
addMessage({ text: messageText })
.then((result) => ....) Usage of generics would help with the function signature: interface AddMessageRequest {
text: string;
}
const functions = getFunctions(firebaseApp);
const addMessage = httpsCallable<AddMessageRequest>(functions, 'addMessage');
addMessage({ text: messageText })
.then((result) => { The response could also typed as well. |
Beta Was this translation helpful? Give feedback.
Answered by
Feiyang1
Feb 11, 2021
Replies: 1 comment 7 replies
-
Thanks for the feedback! It seems to be the right thing to do. @hsubox76 What do you think? |
Beta Was this translation helpful? Give feedback.
7 replies
Answer selected by
Feiyang1
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for the feedback! It seems to be the right thing to do. @hsubox76 What do you think?