fabricjs / fabric.js

Javascript Canvas Library, SVG-to-Canvas (& canvas-to-SVG) Parser
http://fabricjs.com
Other
28.02k stars 3.45k forks source link

SerializedPatternOptions type - union instead of intersection #9906

Closed asturur closed 3 weeks ago

asturur commented 3 weeks ago

Discussed in https://github.com/fabricjs/fabric.js/discussions/9903

Originally posted by **owlcode** June 2, 2024 Looking at `SerializedPatternOptions` type [here](https://github.com/fabricjs/fabric.js/blob/1025c81c1d91e22df0c93ad3daea99d94e4435f0/src/Pattern/types.ts#L17C13-L17C37). Shouldn't it be union instead of intersection? Currently when I'm trying to do ``` Pattern.fromObject( { type: 'pattern', source: 'data:image/png;base64,iVBORw0KGgoAAAANSU....', }, {}, ) ``` typescript is complaining that `source` needs to be of type `CanvasImageSource`. I'm using `6.0.0-rc1`