Unrecognised export keyword in JSLIGO
Given the following contract:
let foo = (u : unit) : unit => {
return u
}
let main = ([parameter, storage] : [list<string>, int]) : [list<operation>, int] => {
return [list([]) as list<operation>, storage]
}
If I want to test it with a Test.originate
I should export the main.
let foo = (u : unit) : unit => {
return u
}
export let main = ([parameter, storage] : [list<string>, int]) : [list<operation>, int] => {
return [list([]) as list<operation>, storage]
}
The compiler refuses it with the following message:
➤ ~/bin/ligo compile contract contract.jsligo
File "contract.jsligo", line 5, characters 0-6:
Ill-formed top-level statement.
At this point, if the statement is complete, one of the following is
expected:
* a semicolon ';' followed by another statement;
* a semicolon ';' followed by the end of file;
* the end of the file.
Therefore if I add a ;
at the end of the definition of foo
, it compiles correctly.
let foo = (u : unit) : unit => {
return u
};
export let main = ([parameter, storage] : [list<string>, int]) : [list<operation>, int] => {
return [list([]) as list<operation>, storage]
}
Edited by Didier Plaindoux