Skip to content

Commit

Permalink
fix: correct defineConfig parameter typing for extending umi
Browse files Browse the repository at this point in the history
  • Loading branch information
tinymins committed Dec 23, 2022
1 parent a197306 commit 86aa9c5
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/types.ts
Expand Up @@ -7,10 +7,11 @@ import type { IModify } from '@umijs/core';
import type { AssetsPackage, ExampleBlockAsset } from 'dumi-assets-types';
import type { Element } from 'hast';
import type { IApi as IUmiApi } from 'umi';
import { defineConfig as defineUmiConfig } from 'umi';

type IUmiConfig = IUmiApi['config'];
type IUmiConfig = Parameters<typeof defineUmiConfig>[0];

export interface IDumiConfig extends IUmiConfig {
interface IDumiExtendsConfig {
resolve: {
docDirs: (string | { type?: string; dir: string })[];
/**
Expand All @@ -32,9 +33,11 @@ export interface IDumiConfig extends IUmiConfig {
// eslint-disable-next-line @typescript-eslint/ban-types
extraRehypePlugins?: (string | Function | [string | Function, object])[];
}
export type IDumiConfig = IUmiConfig & IDumiExtendsConfig;

export interface IDumiUserConfig
extends Partial<Omit<IDumiConfig, 'resolve' | 'locales'>> {
extends Partial<Omit<IDumiConfig, 'resolve' | 'locales'>>,
IUmiConfig {
resolve?: Partial<IDumiConfig['resolve']>;
locales?: (
| IDumiConfig['locales'][0]
Expand Down

0 comments on commit 86aa9c5

Please sign in to comment.