Closed MRDGH2821 closed 7 months ago
I did a minor change:
const SettingsDB = schema(($) => ({
servers: $.collection<Setting, Guild['id']>(),
}));
export default SettingsDB;
async function main() {
console.info('Getting data');
await SettingsDB.servers.get('000000000000000000').then(console.info).catch(console.error);
}
void main();
So my type problem is solved, but I don't get any output
Actually, I was running things with bun runtime. So, it actually didn't work. When I compiled my TS codebase to JS & executed the code, it worked properly.
You may want to explicitly specify that Bun runtime is not currently supported. Btw, I also noticed that Typesaurus automatically used the initialised/authenticated firestore object 🤔
I am referring to https://next.typesaurus.com/design/adopting/ but I can't seem to make a proper schema out of it. Seems like
$<type>()
should be$.collection<type>()
So after putting
.collection
part, I get this linter error:Argument of type 'string' is not assignable to parameter of type 'Id<"servers">'. Type 'string' is not assignable to type '{ [idBrand]: "servers"; }'.
Code snippet:
I executed the code too (with correct id ofcourse), but didn't get any output in console.
Additionally I am wondering how does typesaurus actually authenticate to firebase, because as per the docs, I didn't see any section where I have to input service account of anything. So in a seperate file I wrote the logic of authentication & importing here.