Style: code style

This commit is contained in:
Dreamacro 2023-01-12 16:59:28 +08:00
parent c298eae5bb
commit e463b878b4
3 changed files with 8 additions and 6 deletions

View File

@ -1,6 +1,6 @@
import { IsEqual } from 'type-fest' import { IsEqual } from 'type-fest'
import Infer from '@lib/type' import { Infer } from '@lib/type'
import en_US from './en_US' import en_US from './en_US'
import zh_CN from './zh_CN' import zh_CN from './zh_CN'

View File

@ -1,5 +1,7 @@
type InferRecursion<K extends string, T> = T extends object ? { [P in keyof T]: P extends string ? InferRecursion<`${K}.${P}`, T[P]> : K }[keyof T] : K type InferRecursion<T, K extends string> =
T extends object
? { [P in keyof T]: P extends string ? InferRecursion<T[P], `${K}.${P}`> : K }[keyof T]
: K
type Infer<T> = Extract<{ [K in keyof T]: K extends string ? InferRecursion<K, T[K]> : unknown }[keyof T], string> export type Infer<T> =
Extract<{ [K in keyof T]: K extends string ? InferRecursion<T[K], K> : unknown }[keyof T], string>
export default Infer

View File

@ -17,7 +17,7 @@ import { isClashX, jsBridge } from '@lib/jsBridge'
import { Snapshot } from '@lib/request' import { Snapshot } from '@lib/request'
import * as API from '@lib/request' import * as API from '@lib/request'
import { StreamReader } from '@lib/streamer' import { StreamReader } from '@lib/streamer'
import Infer from '@lib/type' import { Infer } from '@lib/type'
import * as Models from '@models' import * as Models from '@models'
import { Log } from '@models/Log' import { Log } from '@models/Log'