-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
5.9.0
-
None
The lacking documentation caused me to post this StackOverflow question.
The relevant documentation is here.
It seems to imply that the standard - and only - way to import a QML type from JS is with .import FileIO 1.0 as FileIO. But it doesn't mention that - unlike the standard way of importing in QML with import FileIO 1.0 (no leading dot) - you need to use the imported type with a prefix - FileIO.FileIO.readAll(). Nor does it mention that the "{{ as FileIO}}" suffix of the .import statement can be dropped, leading to the simpler usage syntax FileIO.readAll().
It would be good to have these two things mentioned. They're not at all obvious, since they're documented for importing QML from QML, but not for importing QML from JS. More so because the two import cases use different syntax otherwise - one has a leading dot, the other doesn't.