knockout-postbox icon indicating copy to clipboard operation
knockout-postbox copied to clipboard

KO 3.5

Open danparm opened this issue 4 years ago • 7 comments

Looks like with the change to internal types with KO 3.5 there's now a conflict with KO Postbox requiring the external KO types. I'll do some more investigating but seeing as this project hasn't had an update in 4 years I will likely look for another solution.

danparm avatar Dec 22 '20 16:12 danparm

@danparm - I am happy to make an update, if we can figure out the issue. I’ll try to run it with 3.5 when I have a chance here. Do you get an error or how is the best way to see the problem? Thanks!

rniemeyer avatar Dec 22 '20 18:12 rniemeyer

@rniemeyer I’ll try running 3.5 again locally. It’s really a two headed problem for me at the moment. I’m having to update the KO types in my source files since the names changed with the internal typing move. Will report back

danparm avatar Dec 22 '20 18:12 danparm

One of the errors occurs when accessing postbox on the KO object: ko.postbox.publish(...); for example (TS) Property 'postbox' does not exist on type 'typeof import("/node_modules/knockout/build/types/knockout")

Then there's the issue of the interface properties. publishOn() for example throws a TS error because it doesn't exist on Observable (as an example)

I'm no Typescript guru but would a change to the interface names in the postbox types likely solve the problem?

danparm avatar Dec 22 '20 18:12 danparm

I may have something but need to step away for a minute. Extending the KO types with the postbox types seemed to work for part of the issue.

danparm avatar Dec 22 '20 18:12 danparm

Alright, probably didn't have to rename the interfaces but extending the internal KO types I was able to clear all the errors in one TS file (also after updating the KO types in that file to work with the new names). image

image

Just need to work on cleaning this up: image

danparm avatar Dec 22 '20 19:12 danparm

Hit a wall with this though: image

This is where I'm running out of Typescript skills.

Updated my (postbox as KnockoutPostBox) to and export const pb: KnockoutPostBox in the postbox types.

Of course all of this is untested because I can't build my JS.

danparm avatar Dec 22 '20 20:12 danparm