Minor Changes
-
feat: auto-create (and watch)
FileContents
for valid file paths (#79)import anywidget import traitlets class Counter(anywidget.AnyWidget): _esm = "index.js" value = traitlets.Int(0).tag(sync=True)
If a file path for an existing file is detected for
_esm
or_css
,
the contents will be read from disk automatically. If the resolved
path is not insite-packages
(i.e., likely a development install), a
background thread will start watching for file changes and push updates
to the front end. -
feat: add
anywidget/types
to npm package to allow opt-in strictness (#80)// @ts-check /** @type {import("anywidget/types").Render<{ value: number }>} */ export function render(view) { let value = view.model.get("value"); //^ ? `number` view.model.set("value", "not-a-number"); // Error: Argument of type 'string' is not assignable to parameter of type 'number'. [2345] }