cocopon / tweakpane

:control_knobs: Compact GUI for fine-tuning parameters and monitoring value changes
https://tweakpane.github.io/docs/
MIT License
3.69k stars 92 forks source link

typescript `addBlade` interface does not expose `on` method #633

Closed xiduzo closed 1 week ago

xiduzo commented 2 weeks ago

image

const pane = new Pane()

pane
  .addBlade(...)
  .on('change') // does not exist on interface, functionality works fine

the type bring me to node_modules/core/dist/blade/common/api/blade.d.ts which I assume gets generated from https://github.com/cocopon/tweakpane/blob/main/packages/core/src/blade/common/api/blade.ts

cocopon commented 1 week ago

Not of all blades have .on(). See the Blades section:

If you are a TypeScript user, need to cast a created blade to a specific type to access full functionalities: https://tweakpane.github.io/docs/blades/

xiduzo commented 1 week ago

Thanks, I missed that from the docs. My bad.

But can't this be inferred by the view of the blade itself?

cocopon commented 1 week ago

But can't this be inferred by the view of the blade itself?

It's difficult because .addBlade() can be extended by adding plugins. https://tweakpane.github.io/docs/plugins/