Skip to content

Conversation

@kkshyu
Copy link

@kkshyu kkshyu commented Oct 8, 2021

in typescript, we suppose not to use any. we can simply add the generic type on Node to make codes better.
ex.

  const {
    actions: { setProp },
    props,
  } = useNode((node: Node<CraftProgramCollectionProps>) => ({
    props: node.data.props,
  }))

setProps will be:

const setProp: (cb: (props: CraftProgramCollectionProps) => void, throttleRate?: number | undefined) => void

in typescript, we suppose not to use `any`. we can simply add the generic type on Node to make codes better.
ex.
```ts
  const {
    actions: { setProp },
    props,
  } = useNode((node: Node<CraftProgramCollectionProps>) => ({
    props: node.data.props,
  }))
```
`setProps` will be:
```
const setProp: (cb: (props: CraftProgramCollectionProps) => void, throttleRate?: number | undefined) => void
```
@kkshyu kkshyu requested a review from prevwong as a code owner October 8, 2021 20:28
@netlify
Copy link

netlify bot commented Oct 8, 2021

✔️ Deploy Preview for craftjs ready!

🔨 Explore the source changes: c23d863

🔍 Inspect the deploy log: https://app.netlify.com/sites/craftjs/deploys/6160a9dc225b94000830aec2

😎 Browse the preview: https://deploy-preview-330--craftjs.netlify.app

@prevwong prevwong changed the base branch from develop to v0.1.x November 15, 2021 10:40
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.

1 participant