Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
K
Koishi Nestjs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
3rdeye
Koishi Nestjs
Commits
f7cce692
Commit
f7cce692
authored
Nov 11, 2021
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adapt plugin def
parent
8a4b3444
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
18 deletions
+32
-18
src/utility/koishi.interfaces.ts
src/utility/koishi.interfaces.ts
+32
-18
No files found.
src/utility/koishi.interfaces.ts
View file @
f7cce692
...
...
@@ -39,19 +39,31 @@ export interface ContextSelector {
useSelector
?:
OnContextFunction
;
}
export
type
KoishiPluginOptions
<
T
extends
Plugin
|
keyof
Modules
>
=
export
type
KoishiPluginOptions
<
T
extends
keyof
Modules
|
Plugin
>
=
|
boolean
|
(
T
extends
keyof
Modules
?
Plugin
.
ModuleConfig
<
Modules
[
T
]
>
:
Plugin
.
Config
<
T
>
);
:
T
extends
Plugin
?
Plugin
.
Config
<
T
>
:
never
);
export
interface
KoishiModulePlugin
<
T
extends
Plugin
|
keyof
Modules
>
export
interface
KoishiModulePlugin
<
T
extends
keyof
Modules
|
Plugin
>
extends
ContextSelector
{
plugin
:
T
;
options
?:
boolean
|
KoishiPluginOptions
<
T
>
;
}
export
function
PluginDef
<
T
extends
Plugin
|
keyof
Modules
>
(
export
function
PluginDef
<
T
extends
keyof
Modules
>
(
plugin
:
T
,
options
?:
boolean
|
Plugin
.
ModuleConfig
<
Modules
[
T
]
>
,
select
?:
Selection
,
):
KoishiModulePlugin
<
T
>
;
export
function
PluginDef
<
T
extends
Plugin
>
(
plugin
:
T
,
options
?:
boolean
|
Plugin
.
Config
<
T
>
,
select
?:
Selection
,
):
KoishiModulePlugin
<
T
>
;
export
function
PluginDef
<
T
extends
keyof
Modules
|
Plugin
>
(
plugin
:
T
,
options
?:
KoishiPluginOptions
<
T
>
,
select
?:
Selection
,
...
...
@@ -111,7 +123,7 @@ export interface DoRegisterConfigDataMap {
export
interface
MappingStruct
<
T
extends
Record
<
string
|
number
|
symbol
,
any
>
,
K
extends
keyof
T
,
K
extends
keyof
T
>
{
type
:
K
;
data
?:
T
[
K
];
...
...
@@ -119,7 +131,7 @@ export interface MappingStruct<
export
function
GenerateMappingStruct
<
T
extends
Record
<
string
|
number
|
symbol
,
any
>
,
K
extends
keyof
T
,
K
extends
keyof
T
>
(
type
:
K
,
data
?:
T
[
K
]):
MappingStruct
<
T
,
K
>
{
return
{
type
,
...
...
@@ -128,7 +140,7 @@ export function GenerateMappingStruct<
}
export
type
DoRegisterConfig
<
K
extends
keyof
DoRegisterConfigDataMap
=
keyof
DoRegisterConfigDataMap
,
K
extends
keyof
DoRegisterConfigDataMap
=
keyof
DoRegisterConfigDataMap
>
=
MappingStruct
<
DoRegisterConfigDataMap
,
K
>
;
// Command stuff
...
...
@@ -158,7 +170,7 @@ export interface CommandPutConfigMap {
}
export
type
CommandPutConfig
<
K
extends
keyof
CommandPutConfigMap
=
keyof
CommandPutConfigMap
,
K
extends
keyof
CommandPutConfigMap
=
keyof
CommandPutConfigMap
>
=
MappingStruct
<
CommandPutConfigMap
,
K
>
;
export
type
CommandDefinitionFun
=
(
cmd
:
Command
)
=>
Command
;
...
...
@@ -170,17 +182,19 @@ export type MetadataArrayValueMap = {
export
type
MetadataGenericMap
=
MetadataArrayValueMap
&
MetadataMap
;
export
type
MetadataArrayValue
<
K
extends
keyof
MetadataArrayValueMap
>
=
MetadataArrayValueMap
[
K
];
export
type
MetadataArrayValue
<
K
extends
keyof
MetadataArrayValueMap
>
=
MetadataArrayValueMap
[
K
];
export
type
MetadataKey
=
keyof
MetadataArrayMap
|
keyof
MetadataMap
;
export
type
MetadataMapValue
<
K
extends
MetadataKey
>
=
K
extends
keyof
MetadataArrayValueMap
?
MetadataArrayValue
<
K
>
:
K
extends
keyof
MetadataMap
?
MetadataMap
[
K
]
:
never
;
export
type
MetadataMapValue
<
K
extends
MetadataKey
>
=
K
extends
keyof
MetadataArrayValueMap
?
MetadataArrayValue
<
K
>
:
K
extends
keyof
MetadataMap
?
MetadataMap
[
K
]
:
never
;
// command interceptor
...
...
@@ -188,7 +202,7 @@ export interface KoishiCommandInterceptor<
U
extends
User
.
Field
=
never
,
G
extends
Channel
.
Field
=
never
,
A
extends
any
[]
=
any
[],
O
extends
{}
=
{}
,
O
extends
{}
=
{}
>
{
intercept
:
Command
.
Action
<
U
,
G
,
A
,
O
>
;
}
...
...
@@ -197,7 +211,7 @@ export type KoishiCommandInterceptorRegistration<
U
extends
User
.
Field
=
never
,
G
extends
Channel
.
Field
=
never
,
A
extends
any
[]
=
any
[],
O
extends
{}
=
{}
,
O
extends
{}
=
{}
>
=
|
KoishiCommandInterceptor
<
U
,
G
,
A
,
O
>
|
Type
<
KoishiCommandInterceptor
<
U
,
G
,
A
,
O
>>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment