I am new to typescript. I am facing some while declaring Props in typescript as follows:
Types of property 'd' are incompatible.
Type 'string[] | undefined' is not assignable to type 'string | undefined'.
I have one xyzProps which contains some sting type and one is string[] as given below:
const d1: string[] = [];
type xyzProps = {
a: string;
b: string;
c: string;
d: typeof d1;
};
When I am trying to use the above propes as follows then it gives an error
export type abcPageProps = RouteComponentProps<Partial<xyzProps>> & ReduxProps;
Any idea why it gives me this error OR any solution for it.
can you try
type xyzProps = {
a: string;
b: string;
c: string;
d: string[];
};
export type abcPageProps = RouteComponentProps<xyzProps> & ReduxProps;