diff --git a/src/i18n/index.ts b/src/i18n/index.ts index 798e20d..4770d8f 100644 --- a/src/i18n/index.ts +++ b/src/i18n/index.ts @@ -1,6 +1,6 @@ import { IsEqual } from 'type-fest' -import Infer from '@lib/type' +import { Infer } from '@lib/type' import en_US from './en_US' import zh_CN from './zh_CN' diff --git a/src/lib/type.ts b/src/lib/type.ts index 98f6f8c..586c9c2 100644 --- a/src/lib/type.ts +++ b/src/lib/type.ts @@ -1,5 +1,7 @@ -type InferRecursion = T extends object ? { [P in keyof T]: P extends string ? InferRecursion<`${K}.${P}`, T[P]> : K }[keyof T] : K +type InferRecursion = + T extends object + ? { [P in keyof T]: P extends string ? InferRecursion : K }[keyof T] + : K -type Infer = Extract<{ [K in keyof T]: K extends string ? InferRecursion : unknown }[keyof T], string> - -export default Infer +export type Infer = + Extract<{ [K in keyof T]: K extends string ? InferRecursion : unknown }[keyof T], string> diff --git a/src/stores/jotai.ts b/src/stores/jotai.ts index 349a3cd..5ef7570 100644 --- a/src/stores/jotai.ts +++ b/src/stores/jotai.ts @@ -17,7 +17,7 @@ import { isClashX, jsBridge } from '@lib/jsBridge' import { Snapshot } from '@lib/request' import * as API from '@lib/request' import { StreamReader } from '@lib/streamer' -import Infer from '@lib/type' +import { Infer } from '@lib/type' import * as Models from '@models' import { Log } from '@models/Log'