how do you create a function that outputs a number on typescript?

To get the ngSwitch directive to match a number in your expression, you’d need to return the type property on the resulting message object.

For example:

messageType(thread: Thread): any {
    const message = thread.messages.slice().reverse().find(m => m.type !== 0);
    if (message !== undefined) {
        return message.type;
    // return a reasonable default

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top