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

Fix node props #676

Merged
merged 2 commits into from
May 27, 2022
Merged

Fix node props #676

merged 2 commits into from
May 27, 2022

Conversation

maritaria
Copy link
Contributor

The Group type does not expose the correct set of props.
The konva class inherits from Container but the props derive from NodeConfig.
Meaning the props for Container, e.g. those related to cropping, are missing.

As a result IDEs do not type-hint the relevant properties and tooling may even produce warnings / errors about illegal props getting passed.

The first commit notes the correct type for the Group and Label exports.

The second commit the Group-specific config type from konvajs/konva#1337 instead.

@lavrton lavrton merged commit 42b2692 into konvajs:master May 27, 2022
@lavrton
Copy link
Member

lavrton commented May 27, 2022

Thanks.

@maritaria
Copy link
Contributor Author

@lavrton is there an ETA on the release for these changes?

In any case if anyone reads this and want this solved immediately, you can use type casting as a workaround:

import Konva from 'konva';
import { Group as GroupBadType } from 'react-konva';
import { KonvaNodeComponent } from 'react-konva/ReactKonvaCore';

const Group = GroupBadType as KonvaNodeComponent<
  Konva.Group,
  Konva.ContainerConfig
>;

// ...

  <Group clipPath={/* prop is now typed correctly */} />

@lavrton
Copy link
Member

lavrton commented May 30, 2022

Just published [email protected]. Please update konva as well. Please let me know how it works.

@maritaria maritaria deleted the fix-node-props branch May 30, 2022 19:15
@maritaria
Copy link
Contributor Author

Just published [email protected]. Please update konva as well. Please let me know how it works.

Thank you for the update, I'll see to update my deps tomorrow and let you know. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants