Skip to content

Commit

Permalink
fix: correct defineConfig parameter typing (#1389)
Browse files Browse the repository at this point in the history
* fix: tsconfig path alias for dumi

* fix: correct defineConfig parameter typing for extending umi
  • Loading branch information
tinymins committed Dec 26, 2022
1 parent 0932d49 commit 63fd21e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 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
2 changes: 1 addition & 1 deletion tsconfig.json
Expand Up @@ -8,7 +8,7 @@
"baseUrl": "./",
"paths": {
"@/*": ["src/*"],
"@@/*": ["./.dumi/tmp"]
"@@/*": [".dumi/tmp/*"]
},
"types": ["vitest/globals"]
},
Expand Down

0 comments on commit 63fd21e

Please sign in to comment.