This is a generalization of #185, where it was suggested to use an interface for cds_services. I'd like to suggest to expand this approach and apply it to other types, especially inline defined, too. This allows users to use module augmentation to improve the types in their projects.
Examples:
// currently
export const connect : {
// ...
}
// suggested
export interface Connect {
// ...
}
export const connect : Connect;
Example for possible module augmentation:
// index.d.ts
declare module '@sap/cds' {
export interface Connect {
// limit datasource to services available in the project
to( datasource : 'myServiceA' | 'myServiceB', options? : cds_connect_options) : Promise<Service>;
}
}