I'm trying to learn React with TypeScript, and I seem to keep running into TS errors that are a bit vague.
Here is the type definition,
export interface ABC {
config: {
lang: Array<string>,
min_search_length: number,
},
docs: [{
location?: string,
text?: string,
title?: string,
}]
}
When I use it to test for some purpose in a function,
export async function getResult(): Promise<ABC>{
let response;
response =
{
config: {
lang: [
'en',
],
min_search_length: 3,
prebuild_index: false,
separator: '[\\s\\-]+',
},
docs: [
{
location: '#kjaksjh',
text: 'random text',
title: 'random text',
},
{
location: '#cJbcmj',
text: 'random text ',
title: 'random text',
},
],
};
return response.docs;
}
I am facing this error,
Type '{ location: string; text: string; title: string; }[]' is missing the following properties from type 'ABC': config, docs.
What could I be missing?