core-plugin-api: make toInternalTranslationRef forward messages type

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2023-09-14 14:39:58 +02:00
parent 3ee520091b
commit 848491257a
@@ -130,10 +130,11 @@ export function createTranslationRef<
}
/** @internal */
export function toInternalTranslationRef(
ref: TranslationRef,
): InternalTranslationRef {
const r = ref as InternalTranslationRef;
export function toInternalTranslationRef<
TId extends string,
TMessages extends { [key in string]: string },
>(ref: TranslationRef<TId, TMessages>): InternalTranslationRef<TId, TMessages> {
const r = ref as InternalTranslationRef<TId, TMessages>;
if (r.$$type !== '@backstage/TranslationRef') {
throw new Error(`Invalid translation ref, bad type '${r.$$type}'`);
}