'Type {} is missing the following properties from type {}: length, pop, push, concat, and 29 more
const function= () => {
facets = useSearchMoreFacets(
variables
);
};
type UseSearchMoreFacets = {
facets: MappedFacet[] | undefined;
};
export const useSearchMoreFacets = (variables): UseSearchMoreFacets => {
const { data } = useQuery<Data, QuerySearchArgs>(QUERY, {
variables: {
//variables
}
});
return {
facets: facetMapper(data?.search?.facets, user)
};
};
const facetMapper = (facets: Facet[] | undefined, user?: User):
MappedFacet[] | undefined => //stuff//
type ValueType = {
value: string;
count: number;
};
export type MappedFacet = {
id: string;
values: ValueType[];
};
i have a variable facets, which has already been declared and i need to change it in a specific event called via function
now if i try to overwrite facets using useSearchMoreFacets using the same query as in the working initial declaration, i get the error :
Type 'UseSearchMoreFacets' is missing the following properties from type 'MappedFacet[]': length, pop, push, concat, and 29 more
the difference to the inital declaration is, that i use more return values to assing them directly to more variables. but since i specififed only this sole return vale i dont see the problem in that
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|