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

LocalizeContext not declared in types declaration despite being exported #193

Open
adamdharrington opened this issue Jan 21, 2020 · 2 comments

Comments

@adamdharrington
Copy link

Do you want to request a feature or report a bug?

Report a bug & offer fix

What is the current behavior?

Go to: https://codesandbox.io/s/stupefied-bhaskara-fsyir

  • Open App.tsx
  • Notice typescript error stating LocalizeContext is not exported from module

What is the expected behavior?

  • LocalizeContext is exported from the module but not declared in the type definitions. This would involve adding LocalizeContext as an exported member from src/index.d.ts

Which versions of react and react-localize-redux are you using?

  • react@16.12.0
  • react-localize-redux@^3.5.3

Happy to add and open a PR although I wanted to check first given that work is ongoing with v4 and you mentioned you're swamped. If you'll have a chance to release a patch I'll open a PR with the change?

@pedily
Copy link

pedily commented Jul 19, 2020

+1 on this since we want to build a hook helper and need to access the context in a TypeScript environment (ideally without a @ts-ignore statement)

@spassvogel
Copy link

One thing you can do is add a .d.ts file with the following content

import { Context } from 'react'

declare module 'react-localize-redux' {
  export const LocalizeContext: Context<LocalizeContextProps>
}

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

3 participants