Netlify-cms: registerPreviewTemplate ComponentType missing generic type declaration

Created on 10 Apr 2020  路  7Comments  路  Source: netlify/netlify-cms

the types for the registerPreviewTemplate function is missing the Props generic and using it with typescript gives the error JSX.Element' is not assignable to parameter of type 'ComponentType<{}>'. when the component has props

I think the easiest way to solve this is to add the generic [here] (https://github.com/netlify/netlify-cms/blob/92e76011e7a9e8b5370088b0a2c065df66b5f7fb/packages/netlify-cms-core/index.d.ts#L207).

it should be registerPreviewTemplate: (name: string, component: ComponentType<P>) => void;

correct me if I wrong

good first issue

Most helpful comment

Thanks @erezrokah for reviewing and merging my first PR on an open source project. Have a nice day. :)

All 7 comments

Thanks @tafelito, we will gladly accept a PR for this.

@erezrokah I've been meaning to start contributing to netlify-cms. Can I send a PR for this issue?

@tinfoil-knight, go for it 馃槃 Thanks!

@erezrokah Please review #3597.

Thanks @erezrokah for reviewing and merging my first PR on an open source project. Have a nice day. :)

@erezrokah Close this issue.

Was this page helpful?
0 / 5 - 0 ratings