Today I learned Dec/16
Element implicitly has an ‘any’ type because expression of type ‘TransitionStatus’ can’t be used to index type ‘{ entering: { opacity: number; }; entered: { opacity: number; }; exiting: { opacity: number; }; exited: { opacity: number; }; }’.
Property ‘unmounted’ does not exist on type ‘{ entering: { opacity: number; }; entered: { opacity: number; }; exiting: { opacity: number; }; exited: { opacity: number; }; }’.ts(7053)
This error was received after copying from react transition group. It seemed there was something wrong with the type not matching.
A cursory look online revealed this
const transitionStyles: { [key: string]: React.CSSProperties } = {
was a solution. The output value was registering as only the things in the object but it could be a lot more. Switching React.CSSProperties to ‘any’ also theoretically works
entering: { opacity: 1 },
entered: { opacity: 1 },
exiting: { opacity: 0 },
exited: { opacity: 0 },
};
transitionStyles needed to have the output values be defined
Typescript is also interesting. It is important to know that when something is required, ever object that features it becomes required. Neat.