File tree Expand file tree Collapse file tree 2 files changed +7
-2
lines changed
packages/svelte/src/toolbar Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,10 @@ const config = {
12
12
export function configure ( options ) {
13
13
for ( const [ key , value ] of options ) {
14
14
if ( key === 'tools' ) {
15
- for ( const tool of /** @type {import('./public.d.ts').Tool[] }*/ value ) {
15
+ for ( let tool of /** @type {import('./public.d.ts').Config.tools[0][] }*/ value ) {
16
+ if ( typeof tool === 'function' ) {
17
+ tool = tool ( ) ;
18
+ }
16
19
const existing = config . tools . find ( ( t ) => t . name === tool . name ) ;
17
20
if ( existing ) {
18
21
for ( const [ k , v ] of tool ) {
Original file line number Diff line number Diff line change @@ -8,7 +8,9 @@ export interface Tool {
8
8
keyCombo ?: string ;
9
9
disabled ?: boolean ;
10
10
}
11
+ type ToolFn = ( ) => Tool
12
+
11
13
export interface Config {
12
14
position ?: 'top' | 'bottom' ;
13
- tools ?: Tool [ ] ;
15
+ tools ?: ( Tool | ToolFn ) [ ] ;
14
16
}
You can’t perform that action at this time.
0 commit comments