haxetink / tink_core

Core utilities
https://haxetink.github.io/tink_core
MIT License
117 stars 33 forks source link

Promise<Dynamic> and .next - runtime exceptions #173

Open gene-pavlovsky opened 1 year ago

gene-pavlovsky commented 1 year ago

The usage of Dynamic in the example code below doesn't make much sense, but is just a minimal reproducible sample of the issue. The issue occurs in a real project where Dynamic in the actual code makes (a bit) more sense.

Notes:

Issue 1

https://try.haxe.org/#cAe829Cb

final value:Dynamic = { success: true };
Promise.lift(value).next(v -> v.success).handle(o -> trace(o));

Uncaught TypeError: this1.getStatus is not a function,https://try.haxe.org/program/cAe829Cb/run?r=0.13856380911375776,line:489

Issue 2

https://try.haxe.org/#58722815

final service:Dynamic = js.lib.Promise.resolve({ success: true });
Promise.ofJsPromise(service).next(v -> v.success).handle(o -> trace(o));

Uncaught TypeError: next(...).handle is not a function,https://try.haxe.org/program/58722815/run?r=0.009096519480646048,line:530