You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello!
I noticed that when using an import alias for the tables property in the DriftDatabase annotation the generated code is not using the alias, so it won't compile.
I'm not sure how actionable this issue is, I'm sure it's not that common to do this. To give more context, in electricsql a drift schema is generated automatically based on a Postgres schema, so that then the user only needs to do @DriftDatabase(tables: kElectrifiedTables). The tables list is a constant that is also generated automatically ( List<Type>).
This works, but an user reported that the drift code gen wasn't working when using an import alias for the schema file.
It can be reproduced by editing the app example in the repo as follows:
The text was updated successfully, but these errors were encountered:
Thanks for opening the issue, I actually wanted to fix this for a long time! In the writer, we only get a name of the element and its definition uri and we have to resolve its import alias based on that. It's not a fully sound solution, but most instances of this should be fixed by 261c151. That looks up all named imports in a library and picks the first one that matches. It's not correct because, if a name is imported both with and without a name, we won't always pick the right one now. But it's likely that most of these cases are already broken today, and this will at least improve some of them.
Hello!
I noticed that when using an import alias for the
tables
property in theDriftDatabase
annotation the generated code is not using the alias, so it won't compile.I'm not sure how actionable this issue is, I'm sure it's not that common to do this. To give more context, in
electricsql
a drift schema is generated automatically based on a Postgres schema, so that then the user only needs to do@DriftDatabase(tables: kElectrifiedTables)
. The tables list is a constant that is also generated automatically (List<Type>
).This works, but an user reported that the drift code gen wasn't working when using an import alias for the schema file.
It can be reproduced by editing the
app
example in the repo as follows:The text was updated successfully, but these errors were encountered: