Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

In Typescript for JET 7.0.1 we're unable to create a computed observable?

3811392Jun 24 2019 — edited Jun 25 2019

I have Typescript working in a JET 7.0.1 app. However, it is causing issues when I try to create a knockout computed.

The code looks something similar to this:

class Test {

     firstName: KnockoutObservable<string>

     surName: KnockoutObservable<string>

     fullName: KnockoutComputed<string>

    

     constructor(firstName: string, surName: string) {

        this.firstName = ko.observable(firstName)

        this.surName = ko.observable(surName)

       

        this.fullName = ko.computed(() => {

            return this.firstName() + this.surName();

        })

    }

}

I get a run time error on the

this.fullName = ko.computed(() => {...})

The error is:

Property 'fn' is missing in type 'Computed<string>' but required in type 'KnockoutComputed<string>'.ts(2741)
index.d.ts(237, 5): 'fn' is declared here.

The typescript version we are using in the app is 3.1.3, however, I have created a new JET 7 app with Typescript's latest version(3.5.2) to see if the same applies and it does. Generally, Typescript is working fine in the app with knockout observables so it just seems to complain about the knockout computed observables. Everyone in my team is experiencing the same issue too.

Would anyone have any pointers on what to do here?

Cheers,

Sonj.

This post has been answered by Andrew Bennett on Jun 25 2019
Jump to Answer
Comments
Post Details
Added on Jun 24 2019
2 comments
372 views