We are exploring the possibility of integrating redux-toolkit into our application, but I am facing an issue with displaying the documentation comments for our action creators.
Here is our old code snippet:
const ADD_NAME = 'ADD_NAME';
/**
* Sets the name for the user in our state.
* @param name The updated name
*/
export function addName(name: string) {
return {
payload: name,
type: ADD_NAME,
};
}
In my VSCode environment, when I dispatch addName()
, I can hover over the function to see the expected tooltip with the documentation.
Now, when trying to recreate this action creator using redux-toolkit:
/**
* Sets the name for the user in our state.
* @param name The updated name of the User
*/
export const addName = createAction<string>(ADD_NAME);
However, when hovering over the new addName
during a dispatch, instead of seeing my written documentation:
Sets the name for the user in our state.
I encounter the following tooltip message:
Calling this {@link redux#ActionCreator} with an argument will return a {@link PayloadAction} of type T with a payload of P
This tooltip is generated from the internal documentation for ActionCreatorWithPayload
within the redux-toolkit typings file.
My question is, why are the doc comments I added specifically for my addName
action creator not being displayed, and instead, it shows the redux-toolkit doc comments?
Although one involves commenting a function and the other commenting a constant variable, I was expecting my comments for the addName
constant to be reflected in the tooltip. What could I possibly be missing here?