-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: update react-utils and core typings and format
- Loading branch information
Mr.Mao
committed
May 31, 2024
1 parent
f8fb047
commit 7a3e89c
Showing
22 changed files
with
199 additions
and
115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
export type BooleanLike = any | ||
import type { HTMLAttributes, DetailedHTMLProps as _DetailedHTMLProps } from 'react' | ||
|
||
export type DetailedHTMLProps<T = HTMLDivElement> = _DetailedHTMLProps<HTMLAttributes<T>, T> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/* eslint-disable @typescript-eslint/consistent-type-definitions */ | ||
|
||
export type AtwillNumber = string | number | ||
export type AtwillObject = { [key: string]: any } | ||
export type AtwillNumberObject = { [key: string]: AtwillNumber } | ||
export type StringObject = { [key: string]: string } | ||
export type NumberObject = { [key: string]: string } | ||
export type SymbolObject = { [key: string]: symbol } | ||
|
||
export type Key = string | number | symbol | ||
|
||
export type BooleanLike = any |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
export type DeepReadonly<T> = { | ||
readonly [P in keyof T]: T[P] extends object ? DeepReadonly<T[P]> : T[P] | ||
} | ||
|
||
export type DeepRequired<T> = { | ||
[P in keyof T]-?: T[P] extends object ? DeepRequired<T[P]> : T[P] | ||
} | ||
|
||
export type DeepPartial<T> = { | ||
[P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P] | ||
} | ||
|
||
export type DeepReplace<T, K = unknown, V = unknown> = { | ||
[P in keyof T]: K extends P ? V : DeepReplace<T[P], K, V> | ||
} | ||
|
||
export type DeepKeyof<T> = T extends object ? keyof T | DeepKeyof<T[keyof T]> : never |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,3 @@ | ||
export interface AtWillObject { [key: string]: any } | ||
|
||
export type AtWillNumber = string | number | ||
|
||
export interface StringObject { [key: string]: string } | ||
|
||
export type Key = string | number | symbol | ||
|
||
export type DeepReadonly<T> = { | ||
readonly [P in keyof T]: T[P] extends object ? DeepReadonly<T[P]> : T[P] | ||
} | ||
|
||
export type DeepRequired<T> = { | ||
[P in keyof T]-?: T[P] extends object ? DeepRequired<T[P]> : T[P] | ||
} | ||
|
||
export type DeepPartial<T> = { | ||
[P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P] | ||
} | ||
|
||
export type DeepKeyof<T> = T extends object ? keyof T | DeepKeyof<T[keyof T]> : never | ||
|
||
export type DeepReplace<T, K = unknown, V = unknown> = { | ||
[P in keyof T]: K extends P ? V : DeepReplace<T[P], K, V> | ||
} | ||
|
||
export type Option<L extends Key = 'label', V extends Key = 'value', C extends Key = 'children'> = { | ||
[P in L]?: string | ||
} & { | ||
[P in V]?: AtWillNumber | ||
} & { | ||
[P in C]?: Option<L, V, C>[] | ||
} | ||
export * from './atom' | ||
export * from './deep' | ||
export * from './util' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import type { AtwillNumber, Key } from './atom' | ||
|
||
export type Awaitable<T> = T | Promise<T> | ||
export type Arrayable<T> = T | T[] | ||
|
||
export type Option< | ||
L extends Key = 'label', V extends Key = 'value', C extends Key = 'children', | ||
> = { | ||
[P in L]?: string | ||
} & { | ||
[P in V]?: AtwillNumber | ||
} & { | ||
[P in C]?: Option<L, V, C>[] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.