Skip to content

feat: Improvement of SketchProps typing using Generics? #151

Closed
@junwen-k

Description

@junwen-k

First of all, thank you for this great project!
Right now custom props are not statically typed when using typescript. E.g,

<ReactP5Wrapper
    sketch={sketch}
    background="rgb(255, 255, 255)"  // this is not typed
/>
// props are not strictly typed
p5.updateWithProps = (props) => {
  ...
};

Maybe we can implement generics that allow users to specify custom props so the type will be correct. For instance,

const ReactP5WrapperComponent<P = SketchProps>: FC<P5WrapperProps<P>> = ({
  ...
});

Not tested, but it will probably look something like that.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions