I am dealing with a set of URLs for different buttons. These URLs are requested when the user clicks on one of three buttons: Input, Output, and StandardReport.
The StandardReport button opens a window that contains three more buttons named Define, Validate, and Refresh.
export interface StandardReport {
define: string;
validate: string;
refresh: string;
}
interface GeneratedFilesURL {
inputs: string;
outputs: string;
standardReport: StandardReport;
}
export const GENERATED_FILES_URL: GeneratedFilesURL = {
inputs: '/generated_files/input_consolidation',
outputs: '/generated_files/output_consolidation',
standardReport: {
define: '/generated_files/standard_report_define',
validate: '/generated_files/standard_report_validate',
refresh: '/generated_files/standard_report_refresh',
},
};
export type Source = 'inputs' | 'outputs' | StandardReport;
To access the URL, I use GENERATED_FILES_URL[source]
where source
can be either inputs or outputs. When trying to use
Type 'StandardReport' cannot be used as an index type.
, references like GENERATED_FILES_URL.standardReport.define
or GENERATED_FILES_URL.standardReport.validate
also cause issues.
I need assistance in fixing the exact structure of the types. Can you help?
Playground link
For detailed error information, please check the errors tab within the playground environment