chore: fix override type (#36297)

This commit is contained in:
MadCcc 2022-06-29 16:41:42 +08:00 committed by GitHub
parent 0b2acfc6cb
commit 70334ff3c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 10 deletions

View File

@ -11,9 +11,3 @@ export type ElementOf<T> = T extends (infer E)[] ? E : T extends readonly (infer
/** https://github.com/Microsoft/TypeScript/issues/29729 */
export type LiteralUnion<T extends U, U> = T | (U & {});
export type DeepPartial<T> = T extends object
? {
[P in keyof T]?: DeepPartial<T[P]>;
}
: T;

View File

@ -2,7 +2,6 @@ import type { CSSInterpolation } from '@ant-design/cssinjs';
import { Theme, useCacheToken, useStyleRegister } from '@ant-design/cssinjs';
import React from 'react';
import version from '../version';
import type { DeepPartial } from '../_util/type';
import type {
AliasToken,
GlobalToken,
@ -51,7 +50,7 @@ export type {
export const DesignTokenContext = React.createContext<{
token: Partial<SeedToken>;
derivative?: (token: SeedToken) => MapToken;
override?: DeepPartial<OverrideToken>;
override?: OverrideToken;
hashed?: string | boolean;
}>({
token: defaultSeedToken,

View File

@ -41,7 +41,6 @@ import type { ComponentToken as TooltipComponentToken } from '../tooltip/style';
import type { ComponentToken as TransferComponentToken } from '../transfer/style';
import type { ComponentToken as TypographyComponentToken } from '../typography/style';
import type { ComponentToken as UploadComponentToken } from '../upload/style';
import type { DeepPartial } from '../_util/type';
import type { BgPalettes, TextAlphaPalettes } from './themes/IPalettes';
export const PresetColors = [
@ -131,7 +130,11 @@ export interface ComponentTokenMap {
Progress?: ProgressComponentToken;
}
export interface OverrideToken extends DeepPartial<ComponentTokenMap> {
type OverrideComponentToken = {
[key in keyof ComponentTokenMap]: Partial<ComponentTokenMap[key]>;
};
export interface OverrideToken extends OverrideComponentToken {
derivative?: Partial<MapToken>;
/** @private Internal Usage */
alias?: Partial<AliasToken>;