Skip to content

Typescript error using the render method #74

Open

Description

@euanmillar

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.

Activity

  1. euanmillar commented on Mar 19, 2021

    @euanmillar
    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

Metadata

Metadata

Assignees

No one assigned

    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