I came across the following code snippet in some external sources that I intend to incorporate into my project:
const INIT: 'jsonforms/INIT' = 'jsonforms/INIT'
Can someone explain what it means to define a type with a string like
INIT: 'jsonforms/INIT'
? How can a string ('jsonforms/INIT'
) be considered a type?Is there an official term for this concept?
When building with Webpack, I encountered an issue that required an additional loader:
styleTagTransform.js:16 Uncaught Error: Module parse failed: Unexpected token (36:17) File was processed with these loaders: * ./node_modules/@pmmmwh/react-refresh-webpack-plugin/loader/index.js * ./node_modules/source-map-loader/dist/cjs.js You may need an additional loader to handle the result of these loaders. | import { ErrorTranslator, Translator } from '../i18n'; | > export const INIT: 'jsonforms/INIT' = 'jsonforms/INIT'; | export const UPDATE_CORE: 'jsonforms/UPDATE_CORE' = `jsonforms/UPDATE_CORE`; | export const SET_AJV: 'jsonforms/SET_AJV' = 'jsonforms/SET_AJV';
Additionally, another error arises here:
export type CoreActions =
| InitAction
| UpdateCoreAction
| UpdateAction;
What is the significance of the syntax shown above?
Uncaught Error: Module parse failed: Unexpected token (65:7)
File was processed with these loaders:
* ./node_modules/@pmmmwh/react-refresh-webpack-plugin/loader/index.js
* ./node_modules/source-map-loader/dist/cjs.js
You may need an additional loader to handle the result of these loaders.
| export const REMOVE_DEFAULT_DATA = `jsonforms/REMOVE_DEFAULT_DATA`;
|
> export type CoreActions =
| | InitAction
| | UpdateCoreAction