Skip to content

Commit

Permalink
fix types
Browse files Browse the repository at this point in the history
  • Loading branch information
Bamieh committed Oct 26, 2020
1 parent 1fc4de4 commit f1e608e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
4 changes: 1 addition & 3 deletions src/legacy/server/i18n/get_kibana_translation_paths.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,14 @@
*/

import { I18N_RC } from './constants';
import * as path from 'path';
import { KibanaConfig } from '../kbn_server';
import { fromRoot } from '../../../core/server/utils';

jest.mock('./get_translation_paths', () => ({ getTranslationPaths: jest.fn() }));
import { getKibanaTranslatoinPaths } from './get_kibana_translation_paths';
import { getTranslationPaths as mockGetTranslationPaths } from './get_translation_paths';

describe('getKibanaTranslatoinPaths', () => {
const mockConfig = { get: jest.fn() } as KibanaConfig;
const mockConfig = { get: jest.fn() };

beforeEach(() => {
jest.resetAllMocks();
Expand Down
2 changes: 1 addition & 1 deletion src/legacy/server/i18n/get_kibana_translation_paths.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { fromRoot } from '../../../core/server/utils';
import { I18N_RC } from './constants';
import { getTranslationPaths } from './get_translation_paths';

export async function getKibanaTranslatoinPaths(config: KibanaConfig) {
export async function getKibanaTranslatoinPaths(config: Pick<KibanaConfig, 'get'>) {
return await Promise.all([
getTranslationPaths({
cwd: fromRoot('.'),
Expand Down
8 changes: 6 additions & 2 deletions src/legacy/server/i18n/i18n_mixin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,15 @@ import { i18n, i18nLoader } from '@kbn/i18n';
import { basename } from 'path';
import { Server } from 'hapi';
import type { UsageCollectionSetup } from '../../../plugins/usage_collection/server';
import { getKibanaTranslatoinPaths } from './get_translations_path';
import { getKibanaTranslatoinPaths } from './get_kibana_translation_paths';
import KbnServer, { KibanaConfig } from '../kbn_server';
import { registerLocalizationUsageCollector } from './localization';

export async function i18nMixin(kbnServer: KbnServer, server: Server, config: KibanaConfig) {
export async function i18nMixin(
kbnServer: KbnServer,
server: Server,
config: Pick<KibanaConfig, 'get'>
) {
const locale = config.get('i18n.locale') as string;

const translationPaths = await getKibanaTranslatoinPaths(config);
Expand Down

0 comments on commit f1e608e

Please sign in to comment.