Skip to content

TS Errors #2538

@artemchiruhin

Description

@artemchiruhin

Describe the bug

I use JsonForms in my project and I face a problem to compile Typescript.

  1. @jsonforms/react/lib/Renderer.d.ts 17 row
    export type StatelessRenderer<P extends RendererProps> = React.StatelessComponent<P>;
    Error: TS2694: Namespace React has no exported member StatelessComponent
    I`ve solved this error by adding d.ts file and declare React type but it seems like workaround.

  2. @jsonforms/core/src/util/util.ts 104 row

if (isArray(jsonSchema.type)) {
    return jsonSchema.type;
  }

Error: TS2322: Type string | string[] is not assignable to type string[]

My typescript config

{
  "compilerOptions": {
    "target": "es2020",
    "module": "es2015",
    "declaration": true,
    "outDir": "./generated",
    "strict": false,
    "sourceMap": true,
    "jsx": "react-jsx",
    "esModuleInterop": true,

    "moduleResolution": "Bundler",
    "isolatedModules": true,
    "moduleDetection": "force",

    "noUnusedLocals": false,
    "noUnusedParameters": false,
    "noFallthroughCasesInSwitch": true,
    "noUncheckedSideEffectImports": true,

    "baseUrl": ".",
    "paths": {
      "@/*": ["./src/*"]
    }
  },
  "include": ["src"]
}

There was a lot of TS errors, but I set strict to false and almost everything gone except these two errors

Expected behavior

There is no TS errors

Steps to reproduce the issue

  1. Set up vite project
  2. Install "typescript": "~5.6.2", "typescript-eslint": "^8.11.0",
  3. Install @jsonforms/core @jsonforms/react
  4. Set TS config that above
  5. Run tsc

Screenshots

No response

Which Version of JSON Forms are you using?

v3.7.0

Package

Core

Additional context

No response

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions