How do i get my event to a variable type number?

I emit an event and i want to receive the number that my event gives here’s my code:

here’s is where i emit my event, which is right

    this.navCtrl.push(HomePage, {id : id})
    .then(() => {'id:added', id)
    return console.log('id: ',id);

Finally here’s where i get and aplly it:

this.model = new Processos();

        let idGenerator ='id:added', (id) => {
          console.log('Generator' ,id)


            if(idGenerator != null){
              .then((result : any) =>{
                this.model = result;
                return console.log(idGenerator);
              }).catch((e) => console.log('Erro ao carregar os campos', e))


Problem log: [ts] Argument of type ‘void’ is not assignable to parameter of type ‘number’.
let idGenerator: void

The problem is the variable idGenerator receives a value null, and I and want to get value id, which is number???

Thanks in advance!

I think you missunderstood the idea of Promise, Observer, Observable, async etc…

idGenerator is just a “listener”. the subscribe method is called when the listener received something, so this is where you should compare something.

Sorry I m really dumb, i just need to do this:'id:added', (id) => {
            if(id != null){
              .then((result : any) =>{
                this.model = result;
                return console.log('id gerado:',id);
              }).catch((e) => console.log('Erro ao carregar os campos', e))

        }); ```