[Pas2js] ISSUE: [Error] hotreloadclient.pas(252): Incompatible types: got "JSValue" expected "TJSObject"

Michael Van Canneyt michael at freepascal.org
Thu Jul 26 17:30:56 CEST 2018



On Thu, 26 Jul 2018, Frameworks wrote:

> Pas2js / WEB Core Teams:
>
> Presently, when compiling an application using the WEB Core v1.0.0.0
> framework on Delphi Enterprise v10.2.3, WEB Core's included Pas2js compiler
> (v0.9.32+beta) raises the above error at line 252 of hotreloadclient.pas.
>
> We can, however, get the unit to compile successfully by coercing the
> JSValue returned by TJSJSON.parse to TJSObject using toObject as
> follows...
>
>
> Change:
> to:
>    Data:=toObject( TJSJSON.parse(FLastReq.responseText) );
>
>
> Please confirm this is the appropriate fix.

It is.

Alternatively, you can also do
    Data:=TJSJSON.parseObject(FLastReq.responseText);
if you are sure the JSON contains an object.

Michael.


More information about the Pas2js mailing list