no locale available in typescript, cannot be used
See original GitHub issuePackage.json
"react-json-editor-ajrm": "^2.5.13",
"@types/react-json-editor-ajrm": "^2.5.1",
Usage
import React from 'react';
import JSONInput from 'react-json-editor-ajrm';
import locale from 'react-json-editor-ajrm/locale/en'; // this does not exist in typescript, compilation fails
export interface Props {
data: Record<string, unknown>;
onSaveClick: () => void;
}
export default function Configs(p: Props): React.ReactElement<Props> {
return (
<div>
<JSONInput id="a_unique_id" placeholder={{}} theme={'darktheme'} locale={locale} height="550px" />
</div>
);
}
TS7016: Could not find a declaration file for module 'react-json-editor-ajrm/locale/en'.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:11
- Comments:6
Top Results From Across the Web
The locale to use to show error messages in TypeScript in ...
This works in terminal: tsc --locale "cs" error TS2322: Typ 6 nejde přiřadit typu string. But not directly in VS Code: Value "cs"...
Read more >Components | Format.JS
This allows configuration like the current locale and set of translated strings/messages to be provided at the root of a component tree and...
Read more >Intl.Locale - JavaScript - MDN Web Docs
Chrome Edge
Locale Full support. Chrome74. Toggle history Full support. Edge79. Toggle hi...
Locale() constructor Full support. Chrome74. Toggle history Full support. Edge79. Toggle hi...
baseName...
Read more >next-i18next - npm
TypeScript icon, indicating that this package has built-in type declarations ... There is only one exception: You can not use a function for ......
Read more >Documentation - Module Resolution - TypeScript
Finally, if the compiler could not resolve the module, it will log an error. ... Note: node module resolution is the most-commonly used...
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 FreeTop 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
Top GitHub Comments
Same problem here.
Edit
I have found a workaround which consists on copying the constants in the path
react-json-editor-ajrm/locale/XX.js
, whereXX
are the available languages (de, en, es, …) and storing it in a constant variable which is then used as argument of theJSONInput
component:Hope this helps to someonelse.
thanks for the trick dsalgador