I\'m trying to write an interface but it keeps popin\' an error:
\"Property \'success\' of type \'boolean\' is not assignable to string index type \'PageableLarave
Unfortunately that isn't allowed with the index signature syntax that you're using. When you add the index signature ([key: string]: PageableLaravel
) that means that all properties must be PageableLaravel, not just all unspecified properties.
You can solve this with an intersection type though:
export interface PageableLaravel {
path: string;
current_page: number;
from: number;
}
export type Pageable = {
success: boolean;
message: string;
} & {
[key: string]: PageableLaravel
}
TypeScript playground demo