diff options
Diffstat (limited to 'src/lib/data')
| -rw-r--r-- | src/lib/data/types.d.ts | 42 | ||||
| -rw-r--r-- | src/lib/data/vendor.d.ts | 15 |
2 files changed, 57 insertions, 0 deletions
diff --git a/src/lib/data/types.d.ts b/src/lib/data/types.d.ts new file mode 100644 index 0000000..2498bf7 --- /dev/null +++ b/src/lib/data/types.d.ts @@ -0,0 +1,42 @@ +/* + * These types are the structures that we can expect + * from the API. + */ + +export type Topic = { + id: string; + title: string; + ttl: number; + updated_at: number; + tags: Tag[]; + posts: Post[]; + forum: Forum; +}; + +export type Post = { + id: string; + created_at: number; + title: string; + text: string; + topic: Topic; + author: Author; +}; + +export type Tag = { + id: string; + weight: number; + topics: Topic[]; +}; + +export type Forum = { + id: string; + glyph: string; + label: string; + position: number; + topics: Topic[]; +}; + +export type Author = { + id: string; + handle: string; +}; diff --git a/src/lib/data/vendor.d.ts b/src/lib/data/vendor.d.ts new file mode 100644 index 0000000..98e2d46 --- /dev/null +++ b/src/lib/data/vendor.d.ts @@ -0,0 +1,15 @@ +declare module 'language-name-map' { + export type LanguageNameMap = { + [languageCode: string]: LanguageName; + }; + + export type LanguageName = { + name: string; + native: string; + dir: 'rtl' | 'ltr'; + }; + + export function getLangNameFromCode(langCode: string): LanguageName; + export function getLangCodeList(): string[]; + export const languageNameMap: LanguageNameMap; +} |