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

Added Type Definitions #557

Merged
merged 5 commits into from
Oct 20, 2018
Merged

Added Type Definitions #557

merged 5 commits into from
Oct 20, 2018

Conversation

schettino
Copy link
Collaborator

For future releases, feel free to ping me to get the typings updated

Resolves: #550

This PR adds the typescript type definitions.

hoc usage

interface Props extends WithNamespaces {}

export default withNamespaces()<Props>(AddressField);

@coveralls
Copy link

Coverage Status

Coverage remained the same at 76.645% when pulling 6d5e007 on schettino:ts into 5f3c851 on i18next:master.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage remained the same at 76.645% when pulling 6d5e007 on schettino:ts into 5f3c851 on i18next:master.

@jamuhl jamuhl merged commit c3672fd into i18next:master Oct 20, 2018
@jamuhl
Copy link
Member

jamuhl commented Oct 20, 2018

Awesome. Thanks a lot. Was published with react-i18next@8.1.0

Hope i will remember pinging you in case we need to change the definitions - will need to start remembering this.

@schettino
Copy link
Collaborator Author

Anytime @jamuhl. I'll be looking at the issues in case of something related to the typings comes up, and new releases as well. Thanks

@mgroenhoff
Copy link

Is anyone deprecating DT typings https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react-i18next already?

@beheh
Copy link

beheh commented Oct 22, 2018

I'll file a PR against DT.

Filed: DefinitelyTyped/DefinitelyTyped#29945

beheh added a commit to beheh/DefinitelyTyped that referenced this pull request Oct 22, 2018
These have been released upstream as of react-i18next 8.1.0.
See i18next/react-i18next#557.

Closes DefinitelyTyped#29408
Closes DefinitelyTyped#29480
Closes DefinitelyTyped#29685
Closes DefinitelyTyped#29807
beheh added a commit to beheh/DefinitelyTyped that referenced this pull request Oct 22, 2018
The upstream library now ships it's own as of react-i18next 8.1.0.
See i18next/react-i18next#557.

Closes DefinitelyTyped#29408
Closes DefinitelyTyped#29480
Closes DefinitelyTyped#29685
Closes DefinitelyTyped#29807
@brandonhall
Copy link

@schettino Thanks for doing this!

@chillitom
Copy link

chillitom commented Oct 23, 2018

I'm getting the following error after upgrading to use the type definitions from 8.1.0.

C:/code/node_modules/react-i18next/index.d.ts
(2,8): Module '"C:/code/node_modules/@types/i18next/index"' has no default export.

I have the latest i18next module and types installed.

@jchu231
Copy link

jchu231 commented Oct 23, 2018

@schettino, first off - thank you for adding typescript definitions!

I have just updated to v8.1.0 to get your typescript defs, however I am running into this error:
TS2339: Property 'ns' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<Component<NamespacesConsumerProps, ComponentState,...'.

This is caused by something like:

return(
  <NamespacesConsumer ns={[ 'translation', 'common' ]}>
  {( t: any, {i18n}: any ) => (
    <div>
      {t( 'common:dviText' )}
    </div>
  )}
  </NamespacesConsumer>
);

I am fairly new to Typescript, but is this syntax expected to be supported by the Typescript definitions? It is the syntax used in the react-i18next docs.

@mgroenhoff
Copy link

I'm getting the following error after upgrading to use the type definitions from 8.1.0.

C:/code/node_modules/react-i18next/index.d.ts
(2,8): Module '"C:/code/node_modules/@types/i18next/index"' has no default export.

I have the latest i18next module and types installed.

@chillitom The types are written in such a way that it requires the compiler option allowSyntheticDefaultImports to be enabled an depending on the target version maybe also esModuleInterop.

@jamuhl
Copy link
Member

jamuhl commented Oct 24, 2018

@jchu231 @mgroenhoff please create a new issue if having problem - adding comments to closed PR might risk that gets under the table (forgotten)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants