Skip to content

What is the best way to make the document id more accessible? #98

Answered by tylim88
KCErb asked this question in Q&A
Discussion options

You must be logged in to vote

a more accurate and reusable type would be

type GroupWithoutID = {
  labels: { [uid: string]: string },
  participants: string[],
};
export type GroupMetaType = MetaTypeCreator<
  GroupWithoutID,
  'groupsCollection'
>
export type Group = GroupMetaType['read'] & { id: GroupMetaType['docID'] };

data() always return read type

normally document id type is string but it is possible to assign literal type like abc${string}123 to document id type, so it is better to read document id type from meta type

Meta type is your single source of truth, more about meta type https://firelordjs.com/guides/metatype#index-accessor

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@KCErb
Comment options

Answer selected by KCErb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants