Translate class import issue with TypeScript
See original GitHub issueimport { Translate } from 'react-localize-redux';
Throws:
Module '".../node_modules/react-localize-redux/lib/index"' has no exported member 'Translate'.
import Translate from 'react-localize-redux';
Throws:
"export 'default' (imported as 'Translate') was not found in 'react-localize-redux'
import * as Translate from 'react-localize-redux';
Throws:
JSX element type 'Translate' does not have any construct or call signatures.
Modifying
export default class Translate extends ReactComponent<TranslateProps> {}
to
export class Translate extends ReactComponent<TranslateProps> {}
in index.ts.d fixes the issue for me, I can use the following syntax to import Translate without any errors:
import { Translate } from 'react-localize-redux';
Issue Analytics
- State:
- Created 5 years ago
- Comments:9 (5 by maintainers)
Top Results From Across the Web
Documentation - Modules - TypeScript
Modules import one another using a module loader. ... Static methods on an exported class have a similar problem - the class itself...
Read more >How to test translation using Angular 2 Typescript #144 - GitHub
I have setup of angular2-seed project, implemented ng2-translate in it for my application. Now when i try to test translation. it gives error....
Read more >TypeScript import/as vs import/require? - Stack Overflow
I am using TypeScript with Express/Node.js. For consuming modules, the TypeScript Handbook shows the following syntax: import express = require( ...
Read more >Import Statements in TypeScript: Which Syntax to Use
TypeScript has multiple syntaxes for imports. When should you use which? It depends. In this blog, Jessica Kerr shares her thoughts, ...
Read more >Translating TypeScript AWS CDK code to other languages
TypeScript supports importing either an entire namespace, or individual objects from a namespace. Each namespace includes constructs and other classes for ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
yep I had the same issue. Seems ok, although I am still refactoring now to update with the new api.
K problem is the fix I made to make in
2.17.3
didn’t make it in. Currently the TS definition incorrectly exports Translate as default.I have the fix, but I won’t be able to publish until this evening.In the meantime if you want to manually update yourindex.d.ts
file this should fix the issue until I can publish a new package this evening.@gnyekhelyi I was able to publish the fix with the proper export in
v2.17.4
. Please let me know if this solves the issue you’re having.