I have a project with meteor, react and typescript
Below is the part of code where I am getting the error
{message?.errorReason &&
<div>{message?.errorReason}</div>
}
I am getting error
Property 'errorReason' does not exist on type 'MessageWithMdEnforced'
export type MessageWithMdEnforced = WithRequiredProperty<IMessage, 'md'>;
type WithRequiredProperty<Type, Key extends keyof Type> = Omit<Type, Key> & {
[Property in Key]-?: Type[Property];
};
Why the error occurs ?
Can anyone tell me where to add errorReason
?
CodePudding user response:
You need to define type in IMessage
interface.
You would find it in your project
interface IMessage extends SomeClass{
prop?: string,
...
...
...
errorReason?: any
}