react-json-editor-ajrm
react-json-editor-ajrm copied to clipboard
Error importing locale from 'react-json-editor-ajrm/locale/en'
- What version of RJEA are you using (react-json-editor-ajrm version)?
2.5.13
- What operating system and processor architecture are you using?
Windows 10 , 64 bit using Visual Studio
- What did you do?
Running the simple import module on a React/.net Core project
import * as React from 'react';
import JSONInput from 'react-json-editor-ajrm';
import locale from 'react-json-editor-ajrm/locale/en';
My NPM install
npm install --save @progress/kendo-data-query @progress/kendo-date-math @progress/kendo-drawing @progress/kendo-popup-common @progress/kendo-react-animation @progress/kendo-react-buttons @progress/kendo-react-common @progress/kendo-react-data-tools @progress/kendo-react-dateinputs @progress/kendo-react-dialogs @progress/kendo-react-dropdowns @progress/kendo-react-form @progress/kendo-react-grid @progress/kendo-react-inputs @progress/kendo-react-intl @progress/kendo-react-labels @progress/kendo-react-layout @progress/kendo-react-popup @progress/kendo-react-progressbars @progress/kendo-theme-default react-json-editor-ajrm @types/react-json-editor-ajrm
- What did you expect to see?
No errors while compiling.
- What did you see instead?
I am seeing the following error.
_Severity Code Description Project File Line Suppression State Error TS7016 (TS) Could not find a declaration file for module 'react-json-editor-ajrm/locale/en'. '{filepath}/node_modules/react-json-editor-ajrm/locale/en.js' implicitly has an 'any' type.
If the 'react-json-editor-ajrm' package actually exposes this module, consider sending a pull request to amend 'https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react-json-editor-ajrm` _
The same problem...
I solved this error by doing the following.
Go to "/locale/en.js" in this npm and copy the code.
export const localeEn = {
format: "{reason} at line {line}",
symbols: {
colon: "colon", //
comma: "comma", // , ، 、
semicolon: "semicolon", // ;
slash: "slash", // / relevant for comment syntax support
backslash: "backslash", // \ relevant for escaping character
brackets: {
round: "round brackets", // ( )
square: "square brackets", // [ ]
curly: "curly brackets", // { }
angle: "angle brackets", // < >
},
period: "period", // . Also known as full point, full stop, or dot
quotes: {
single: "single quote", // '
double: "double quote", // "
grave: "grave accent", // ` used on Javascript ES6 Syntax for String Templates
},
space: "space", //
ampersand: "ampersand", // &
asterisk: "asterisk", // * relevant for some comment sytanx
at: "at sign", // @ multiple uses in other coding languages including certain data types
equals: "equals sign", // =
hash: "hash", // #
percent: "percent", // %
plus: "plus", // +
minus: "minus", // −
dash: "dash", // −
hyphen: "hyphen", // −
tilde: "tilde", // ~
underscore: "underscore", // _
bar: "vertical bar", // |
},
types: {
// ... Reference: https://en.wikipedia.org/wiki/List_of_data_structures
key: "key",
value: "value",
number: "number",
string: "string",
primitive: "primitive",
boolean: "boolean",
character: "character",
integer: "integer",
array: "array",
float: "float",
},
invalidToken: {
tokenSequence: {
prohibited: "'{firstToken}' token cannot be followed by '{secondToken}' token(s)",
permitted: "'{firstToken}' token can only be followed by '{secondToken}' token(s)",
},
termSequence: {
prohibited: "A {firstTerm} cannot be followed by a {secondTerm}",
permitted: "A {firstTerm} can only be followed by a {secondTerm}",
},
double: "'{token}' token cannot be followed by another '{token}' token",
useInstead: "'{badToken}' token is not accepted. Use '{goodToken}' instead",
unexpected: "Unexpected '{token}' token found",
},
brace: {
curly: {
missingOpen: "Missing '{' open curly brace",
missingClose: "Open '{' curly brace is missing closing '}' curly brace",
cannotWrap: "'{token}' token cannot be wrapped in '{}' curly braces",
},
square: {
missingOpen: "Missing '[' open square brace",
missingClose: "Open '[' square brace is missing closing ']' square brace",
cannotWrap: "'{token}' token cannot be wrapped in '[]' square braces",
},
},
string: {
missingOpen: "Missing/invalid opening string '{quote}' token",
missingClose: "Missing/invalid closing string '{quote}' token",
mustBeWrappedByQuotes: "Strings must be wrapped by quotes",
nonAlphanumeric: "Non-alphanumeric token '{token}' is not allowed outside string notation",
unexpectedKey: "Unexpected key found at string position",
},
key: {
numberAndLetterMissingQuotes: "Key beginning with number and containing letters must be wrapped by quotes",
spaceMissingQuotes: "Key containing space must be wrapped by quotes",
unexpectedString: "Unexpected string found at key position",
},
noTrailingOrLeadingComma: "Trailing or leading commas in arrays and objects are not permitted",
};
export const dark_vscode_tribute = {
default: "#D4D4D4",
background: "#2A2E37",
background_warning: "#1E1E1E",
string: "#CE8453",
number: "#B5CE9F",
colon: "#49B8F7",
keys: "#9CDCFE",
keys_whiteSpace: "#AF74A5",
primitive: "#6392C6",
};
import JSONInput from "react-json-editor-ajrm";
import { dark_vscode_tribute, localeEn } from "src/utils/jsonEditor";
export const JsonForm = () => {
return (
<JSONInput
colors={dark_vscode_tribute}
locale={localeEn}
height="100%"
width="100%"
/>
You can create a file react-json-editor-ajrm/locale/en.d.ts with following content-
declare module 'react-json-editor-ajrm/locale/en';
This will set the type as any.
I no longer intend to update this project. I am working instead on a complete rewrite.
I'd like to thank you for using and taking interest in this project.
I also would like to apologize for not following up sooner. However, do realize for the most part this has been a one-man show, and the occasional contributions I used to receive. What I am saying is, I am in dire need of volunteers.
If this is something you would be interested in participating in, you can join in the discussion.
I've taken note of this thread, and I'll keep this under consideration for the new project.