Skip to content

feat(react): improve split props fn #40

Closed
@cschroeter

Description

@cschroeter

Two ideas that came to mind:

a) when using the splitProps fn I would love to define a target type that is used for autocompletion
b) when using the splitProps fn it should fail on typecheck if not all props are destructured. so if a new property is added our build pipeline would fail

here is an example:

interface Maschine {
  value?: string
  newProperty?: string // was added recently
}

const [machineProps, rest] = splitProps<Maschine>(props, ["value", "newProperty"]) // OK
const [machineProps, rest] = splitProps<Maschine>(props, ["value"]) // Error -> missing value newProperty

Love to hear your thoughts @TimKolberger

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions