Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP fix(Group): Make TS more flexible fore group subclasses #10092

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## [next]

- WIP fix(Group): Make TS more flexible fore group subclasses [#10092](https://github.com/fabricjs/fabric.js/pull/10092)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fore > for

- fix(SVGImport): Allow parsing of 'id' attribute that starts with a number [#10079](https://github.com/fabricjs/fabric.js/pull/10079)
- fix(filter): pixelate filter has non square pixels in webgl (#10081)
- feat(Canvas): Avoid styling the lower canvas with absolute positioning [#10077](https://github.com/fabricjs/fabric.js/pull/10077)
Expand Down
16 changes: 9 additions & 7 deletions src/shapes/Group.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,16 @@ export const groupDefaultValues: Partial<TClassProperties<Group>> = {
* @fires layout:before
* @fires layout:after
*/
export class Group
// @ts-expect-error Group does not really implment Props.
export class Group<
Props extends TOptions<GroupProps> = Partial<GroupProps>,
SProps extends SerializedGroupProps = SerializedGroupProps,
// EventSpec extends GroupEvents = GroupEvents, // can't do this yet
>
extends createCollectionMixin(
FabricObject<GroupProps, SerializedGroupProps, GroupEvents>,
)
implements GroupProps
implements GroupProps, Props
{
/**
* Used to optimize performance
Expand Down Expand Up @@ -572,12 +577,9 @@ export class Group
* @return {Object} object representation of an instance
*/
toObject<
T extends Omit<
GroupProps & TClassProperties<this>,
keyof SerializedGroupProps
>,
T extends Omit<Props & TClassProperties<this>, keyof SProps>,
K extends keyof T = never,
>(propertiesToInclude: K[] = []): Pick<T, K> & SerializedGroupProps {
>(propertiesToInclude: K[] = []): Pick<T, K> & SProps {
const layoutManager = this.layoutManager.toObject();

return {
Expand Down
Loading