-
Notifications
You must be signed in to change notification settings - Fork 512
Description
Context
PR #9262 introduced CreateNodeOptions to replace the untyped Dictionary<unknown> parameter in createNode. The current implementation uses Partial<Omit<LGraphNode, 'constructor' | 'inputs' | 'outputs'>> as the base, which exposes the entire LGraphNode surface (hundreds of properties and methods like computeSize, onNodeCreated, connect, etc.) as valid creation-time options.
Proposed Refinement
Narrow CreateNodeOptions to a Pick of properties that actually make sense as creation-time options (e.g., pos, properties, flags, size, mode, title, color, bgcolor).
Key Considerations
This is a deliberate API boundary decision that requires:
-
Ecosystem audit: Catalog which properties callers actually pass today. Initial scan of ~50 custom node repos shows almost all pass only
pos, with one internal caller passingoutputs. -
Unsupported properties: Decide what happens when someone needs a property not in the
Pickset. Do they cast? Do you add it? This creates an ongoing maintenance surface. -
Migration path: Consider deprecation/migration path if any external TypeScript consumers were relying on the current permissiveness.
References
- Original PR: [refactor] Type createNode options parameter #9262
- Discussion: [refactor] Type createNode options parameter #9262 (comment)
- Requested by: @christian-byrne
This refinement deserves its own focused PR with explicit sign-off on the allowed property set.
┆Issue is synchronized with this Notion page by Unito