File tree Expand file tree Collapse file tree 2 files changed +6
-5
lines changed
packages/svelte/src/toolbar Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -10,15 +10,16 @@ const config = {
10
10
* @param {Partial<import('./public.d.ts').Config> } options
11
11
*/
12
12
export function configure ( options ) {
13
- for ( const [ key , value ] of options ) {
13
+ for ( const [ key , value ] of Object . entries ( options ) ) {
14
14
if ( key === 'tools' ) {
15
15
for ( let tool of /** @type {import('./public.d.ts').Config.tools[0][] }*/ value ) {
16
16
if ( typeof tool === 'function' ) {
17
- tool = tool ( ) ;
17
+ tool = tool ( ) ; // TODO lazy init?
18
18
}
19
+ /** @type {import('./public.d.ts').Tool }*/
19
20
const existing = config . tools . find ( ( t ) => t . name === tool . name ) ;
20
21
if ( existing ) {
21
- for ( const [ k , v ] of tool ) {
22
+ for ( const [ k , v ] of Object . entries ( tool ) ) {
22
23
existing [ k ] = v ;
23
24
}
24
25
} else {
Original file line number Diff line number Diff line change @@ -3,8 +3,8 @@ export * from './index.js';
3
3
export interface Tool {
4
4
name : string ;
5
5
icon : string ; // url or svg
6
- activate ( ) ;
7
- deactivate ( ) ;
6
+ activate : ( ) => void ;
7
+ deactivate : ( ) => void ;
8
8
keyCombo ?: string ;
9
9
disabled ?: boolean ;
10
10
}
You can’t perform that action at this time.
0 commit comments