diff --git a/generators/angular/support/translate-angular.ts b/generators/angular/support/translate-angular.ts index 99f6675f789c..7985bf4879d1 100644 --- a/generators/angular/support/translate-angular.ts +++ b/generators/angular/support/translate-angular.ts @@ -47,7 +47,7 @@ export type ReplacerOptions = { jhiPrefix: string; enableTranslation: boolean }; * @returns {string} */ function replaceTranslationKeysWithText( - getWebappTranslation: (key: string, val?: Record | undefined) => string, + getWebappTranslation: (s: string, val?: Record | undefined) => string, content: string, regexSource: string, { @@ -79,7 +79,7 @@ function replaceTranslationKeysWithText( * @returns string with jsKey value replaced */ function replaceJSTranslation( - getWebappTranslation: (key: string, val?: Record | undefined) => string, + getWebappTranslation: (s: string, val?: Record | undefined) => string, content: string, jsKey: string, ) { @@ -99,14 +99,14 @@ function replaceJSTranslation( * @param {string} content html content * @returns string with pageTitle replaced */ -function replacePageTitles(getWebappTranslation: (key: string, val?: Record | undefined) => string, content: string) { +function replacePageTitles(getWebappTranslation: (s: string, val?: Record | undefined) => string, content: string) { return replaceJSTranslation(getWebappTranslation, content, 'title'); } /** * @type {function(import('../generator-base.js'), string): string} */ -function replacePlaceholders(getWebappTranslation: (key: string, val?: Record | undefined) => string, content: string) { +function replacePlaceholders(getWebappTranslation: (s: string, val?: Record | undefined) => string, content: string) { return replaceTranslationKeysWithText(getWebappTranslation, content, PLACEHOLDER_REGEX, { keyIndex: 2 }); } @@ -115,7 +115,7 @@ function replacePlaceholders(getWebappTranslation: (key: string, val?: Record | undefined) => string, content: string) { +function replaceErrorMessage(getWebappTranslation: (s: string, val?: Record | undefined) => string, content: string) { return replaceJSTranslation(getWebappTranslation, content, 'errorMessage'); } @@ -124,7 +124,7 @@ function replaceErrorMessage(getWebappTranslation: (key: string, val?: Record | undefined) => string, + getWebappTranslation: (s: string, val?: Record | undefined) => string, { enableTranslation, jhiPrefix }: ReplacerOptions, { key, parsedInterpolate, prefix, suffix }: JHITranslateConverterOptions, ) => { @@ -297,7 +297,7 @@ const replaceImplementations: Record< * @this {import('../generator-base.js')} */ export const createTranslationReplacer = ( - getWebappTranslation: (key: string, val?: Record | undefined) => string, + getWebappTranslation: (s: string, val?: Record) => string, opts: ReplacerOptions | boolean, ) => { const htmlJhiTranslateReplacer = createJhiTransformTranslateReplacer(getWebappTranslation, { escapeHtml: true }); @@ -348,7 +348,7 @@ const minimatch = new Minimatch('**/*{.html,.ts}'); export const isTranslatedAngularFile = file => minimatch.match(file.path); export const translateAngularFilesTransform = ( - getWebappTranslation: (key: string, val?: Record | undefined) => string, + getWebappTranslation: (s: string, val?: Record) => string, opts: ReplacerOptions | boolean, ) => { const translate = createTranslationReplacer(getWebappTranslation, opts); diff --git a/generators/client/support/template-utils.ts b/generators/client/support/template-utils.ts index 1b359b752c54..52948a518edb 100644 --- a/generators/client/support/template-utils.ts +++ b/generators/client/support/template-utils.ts @@ -20,6 +20,7 @@ import path from 'path'; import { clientFrameworkTypes, fieldTypes } from '../../../lib/jhipster/index.js'; import type { PrimaryKey } from '../../../lib/types/application/entity.js'; +import type { FieldType } from '../../../lib/application/field-types.js'; import type { Field } from '../../../lib/types/application/index.js'; import { getEntryIfTypeOrTypeAttribute } from './types-utils.js';