add types for translation manifest

This commit is contained in:
Jacob Overgaard
2023-07-25 11:40:35 +02:00
parent 641884ecdf
commit 22a88d2a52
3 changed files with 37 additions and 0 deletions

View File

@@ -100,6 +100,15 @@ export interface ManifestClassWithClassConstructor<T = unknown> extends Manifest
class: ClassConstructor<T>;
}
export interface ManifestDefaultExport<T = unknown> extends ManifestWithLoader<{ default: T }> {
/**
* The file location of the javascript file to load
*
* @TJS-require
*/
js?: string;
}
export interface ManifestElement<ElementType extends HTMLElement = HTMLElement>
extends ManifestWithLoader<{ default: ClassConstructor<ElementType> } | Omit<object, 'default'>> {
/**

View File

@@ -20,6 +20,7 @@ import type { ManifestSectionView } from './section-view.model.js';
import type { ManifestStore, ManifestTreeStore, ManifestItemStore } from './store.model.js';
import type { ManifestTheme } from './theme.model.js';
import type { ManifestTinyMcePlugin } from './tinymce-plugin.model.js';
import type { ManifestTranslations } from './translations.model.js';
import type { ManifestTree } from './tree.model.js';
import type { ManifestTreeItem } from './tree-item.model.js';
import type { ManifestUserProfileApp } from './user-profile-app.model.js';
@@ -89,6 +90,7 @@ export type ManifestTypes =
| ManifestStore
| ManifestTheme
| ManifestTinyMcePlugin
| ManifestTranslations
| ManifestTree
| ManifestTreeItem
| ManifestTreeStore

View File

@@ -0,0 +1,26 @@
import type { ManifestDefaultExport } from '@umbraco-cms/backoffice/extension-api';
export interface ManifestTranslations extends ManifestDefaultExport<Record<string, Record<string, string>>> {
type: 'translations';
meta: MetaTranslations;
}
export interface MetaTranslations {
/**
* The culture of the translations.
* @example "en-US"
*/
culture: string;
/**
* The translations.
* @example
* {
* "general": {
* "cancel": "Cancel",
* "close": "Close"
* }
* }
*/
translations?: Record<string, Record<string, string>>;
}