File tree Expand file tree Collapse file tree 3 files changed +13
-3
lines changed Expand file tree Collapse file tree 3 files changed +13
-3
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ " @anywidget/deno " : patch
3
+ ---
4
+
5
+ Prefer interface over type for WidgetOptions
Original file line number Diff line number Diff line change 29
29
"@std/testing" : " jsr:@std/testing@0.220.1" ,
30
30
"unzipit" : " npm:unzipit@1.4" ,
31
31
"zod" : " npm:zod@3.9"
32
+ },
33
+ "publish" : {
34
+ "exclude" : [" npm.README.md" ]
32
35
}
33
36
}
Original file line number Diff line number Diff line change @@ -222,20 +222,22 @@ function to_esm<State>({
222
222
return `${ imports } \nexport default { render: ${ render . toString ( ) } }` ;
223
223
}
224
224
225
+ type Awaitable < T > = T | Promise < T > ;
226
+
225
227
/** The options bag to pass to the {@link widget} method. */
226
- export type WidgetOptions < State > = {
228
+ export interface WidgetOptions < State > {
227
229
/** The initial widget state. */
228
230
state : State ;
229
231
/** A function that renders the widget. This function is serialized and sent to the front end. */
230
232
render : ( context : {
231
233
model : FrontEndModel < State > ;
232
234
el : HTMLElement ;
233
- } ) => unknown ;
235
+ } ) => Awaitable < ( ( ) => Awaitable < void > ) | undefined > ;
234
236
/** The imports required for the front-end function. */
235
237
imports ?: string ;
236
238
/** The version of the anywidget front end to use. */
237
239
version ?: string ;
238
- } ;
240
+ }
239
241
240
242
/**
241
243
* Creates an anywidget for the Deno Jupyter kernel.
You can’t perform that action at this time.
0 commit comments