From 4da84105a2edad02a5b2af65aad1a5b8ac6d5140 Mon Sep 17 00:00:00 2001 From: Daniel Lautzenheiser Date: Sat, 5 Nov 2022 23:55:37 -0400 Subject: [PATCH] Improve init types --- core/src/bootstrap.tsx | 9 ++++++--- core/src/interface.ts | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/core/src/bootstrap.tsx b/core/src/bootstrap.tsx index 416bb040..d368c721 100644 --- a/core/src/bootstrap.tsx +++ b/core/src/bootstrap.tsx @@ -20,7 +20,7 @@ import { store } from './store'; import type { AnyAction } from '@reduxjs/toolkit'; import type { ConnectedProps } from 'react-redux'; -import type { Config } from './interface'; +import type { BaseField, Config, UnknownField } from './interface'; import type { RootState } from './store'; const ROOT_ID = 'nc-root'; @@ -50,7 +50,10 @@ export type AppRootProps = ConnectedProps; const ConnectedTranslatedApp = connector(TranslatedApp); -function bootstrap(opts?: { config?: Config; autoInitialize?: boolean }) { +function bootstrap(opts?: { + config?: Config; + autoInitialize?: boolean; +}) { const { config, autoInitialize = true } = opts ?? {}; /** @@ -86,7 +89,7 @@ function bootstrap(opts?: { config?: Config; autoInitialize?: boolean }) { } store.dispatch( - loadConfig(config, function onLoad(config) { + loadConfig(config as Config | undefined, function onLoad(config) { if (config.backend.name !== 'git-gateway') { store.dispatch(authenticateUser() as unknown as AnyAction); } diff --git a/core/src/interface.ts b/core/src/interface.ts index 10fe73ad..24e09c80 100644 --- a/core/src/interface.ts +++ b/core/src/interface.ts @@ -478,7 +478,7 @@ export type AuthScope = 'repo' | 'public_repo'; export type SlugEncoding = 'unicode' | 'ascii'; -export type RenderedField = Omit & { +export type RenderedField = Omit & { fields?: ReactNode[]; };