Skip to content

Commit 4427a98

Browse files
committed
fix types
1 parent d330a30 commit 4427a98

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

packages/svelte/src/toolbar/configure.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,16 @@ const config = {
1010
* @param {Partial<import('./public.d.ts').Config>} options
1111
*/
1212
export function configure(options) {
13-
for (const [key, value] of options) {
13+
for (const [key, value] of Object.entries(options)) {
1414
if (key === 'tools') {
1515
for (let tool of /** @type {import('./public.d.ts').Config.tools[0][]}*/ value) {
1616
if(typeof tool === 'function') {
17-
tool = tool();
17+
tool = tool(); // TODO lazy init?
1818
}
19+
/** @type {import('./public.d.ts').Tool}*/
1920
const existing = config.tools.find((t) => t.name === tool.name);
2021
if (existing) {
21-
for (const [k, v] of tool) {
22+
for (const [k, v] of Object.entries(tool)) {
2223
existing[k] = v;
2324
}
2425
} else {

packages/svelte/src/toolbar/public.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ export * from './index.js';
33
export interface Tool {
44
name: string;
55
icon: string; // url or svg
6-
activate();
7-
deactivate();
6+
activate:()=>void;
7+
deactivate:()=>void;
88
keyCombo?: string;
99
disabled?: boolean;
1010
}

0 commit comments

Comments
 (0)