Hey there,
it would be great to enhance the type safety when working with events.
Given a sample with two services (A and B), if an event is defined in service A, such as:
event SomeService.SomeEvent : {
ID : SomeEntity:ID;
}
and e.g. consumed in service B, such as:
import SomeService, {
SomeEvent,
} from '#cds-models/SomeService';
//...
export default class SomeOtherService extends cds.ApplicationService {
override async init() {
// ...
const someService = await cds.connect.to(SomeService);
someService.on(SomeEvent, async (msg) => {
console.log(msg.data);
});
// ...
then msg (or msg.data) or not yet typed. The properties are eventually available in the class, yet not "exposed" in that kind of usage.
Br,
Tobias
Hey there,
it would be great to enhance the type safety when working with events.
Given a sample with two services (A and B), if an event is defined in service A, such as:
and e.g. consumed in service B, such as:
then msg (or msg.data) or not yet typed. The properties are eventually available in the class, yet not "exposed" in that kind of usage.
Br,
Tobias