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

Typescript error using the render method #74

Open
euanmillar opened this issue Mar 19, 2021 · 1 comment
Open

Typescript error using the render method #74

euanmillar opened this issue Mar 19, 2021 · 1 comment

Comments

@euanmillar
Copy link

Hi,

I am migrating a js project that uses react-i18nify to Typescript. In many cases in the app I see the developer is using the render prop like this:

<I18n
        render={() => {

But the Typescript type does not expose this prop:

export class I18n extends React.Component {}

Therefore you get a "Property 'render' does not exist on type" error.

Many thanks.

@euanmillar
Copy link
Author

I'm not sure if this is right, but this seems to suppress the errror:

export interface I18nRender {
  render: () => JSX.Element
}

export class I18n<T extends I18nRender> extends React.Component<T, {}> { }

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

No branches or pull requests

1 participant