Must [sync] methods be always "procedures"?

I am having trouble finding documentation about a specific term.

I created a [sync] function that returns a Boolean value, but when I try to call it, I encounter a compilation error that says: "Incompatible types: got 'TJSPromise' expected 'Boolean'" in line 135 of my Tutors.pas file.

I am not sure if I am doing something wrong.

Hi,

I assume you mean [async] instead of [sync]?
That is because when you mark a method as [async] it will be transpiled to a JavaScript async function and an async JavaScript function is automatically returning a Promise (= TJSPromise) so it cannot return a Boolean.

It can be challenging to understand this concept first, try to read this explanation from earlier:

So what you'll probably need is to create a promise that resolves with your boolean value and await that.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.