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

schettino commented Oct 20, 2018

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

This comment has been minimized.

Copy link

coveralls commented Oct 20, 2018

Coverage Status

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

1 similar comment
@coveralls

This comment has been minimized.

Copy link

coveralls commented Oct 20, 2018

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
3 checks passed
3 checks passed
codeclimate All good!
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
coverage/coveralls Coverage remained the same at 76.645%
Details
@jamuhl

This comment has been minimized.

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

This comment has been minimized.

Copy link
Collaborator Author

schettino commented Oct 20, 2018

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

This comment has been minimized.

Copy link

mgroenhoff commented Oct 22, 2018

@beheh

This comment has been minimized.

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

This comment has been minimized.

Copy link

brandonhall commented Oct 22, 2018

@schettino Thanks for doing this!

@chillitom

This comment has been minimized.

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.

@jamuhl jamuhl added the typescript label Oct 23, 2018
@jchu231

This comment has been minimized.

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

This comment has been minimized.

Copy link

mgroenhoff 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.

@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

This comment has been minimized.

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
8 participants
You can’t perform that action at this time.