Type errors from survey-creator-react

This issue has been tracked since 2023-03-15.

Are you requesting a feature, reporting a bug or ask a question?

I am reporting a bug

What is the current behavior?

When I try to compile a react app with typescript and survey-creator-react installed, I get the following error:

node_modules/survey-creator-core/survey-creator-core.d.ts:7681:16 - error TS2451: Cannot redeclare block-scoped variable 'Version'.

7681     export let Version: string;
                    ~~~~~~~

  node_modules/survey-creator-react/survey-creator-react.d.ts:743:16
    743     export let Version: string;
                       ~~~~~~~
    'Version' was also declared here.

node_modules/survey-creator-core/survey-creator-core.d.ts:7683:14 - error TS2300: Duplicate identifier 'editorLocalization'.

7683     export { editorLocalization, defaultStrings } from "editorLocalization";
                  ~~~~~~~~~~~~~~~~~~

  node_modules/survey-creator-react/survey-creator-react.d.ts:787:14
    787     export { editorLocalization, localization } from "survey-creator-core";
                     ~~~~~~~~~~~~~~~~~~
    'editorLocalization' was also declared here.

node_modules/survey-creator-core/survey-creator-core.d.ts:7684:36 - error TS2300: Duplicate identifier 'localization'.

7684     export { editorLocalization as localization } from "editorLocalization";
                                        ~~~~~~~~~~~~

  node_modules/survey-creator-react/survey-creator-react.d.ts:787:34
    787     export { editorLocalization, localization } from "survey-creator-core";
                                         ~~~~~~~~~~~~
    'localization' was also declared here.

node_modules/survey-creator-react/survey-creator-react.d.ts:743:16 - error TS2451: Cannot redeclare block-scoped variable 'Version'.

743     export let Version: string;
                   ~~~~~~~

  node_modules/survey-creator-core/survey-creator-core.d.ts:7681:16
    7681     export let Version: string;
                        ~~~~~~~
    'Version' was also declared here.

node_modules/survey-creator-react/survey-creator-react.d.ts:784:19 - error TS2498: Module '"events"' uses 'export =' and cannot be used with 'export *'.

784     export * from "events";
                      ~~~~~~~~

node_modules/survey-creator-react/survey-creator-react.d.ts:787:14 - error TS2300: Duplicate identifier 'editorLocalization'.

787     export { editorLocalization, localization } from "survey-creator-core";
                 ~~~~~~~~~~~~~~~~~~

  node_modules/survey-creator-core/survey-creator-core.d.ts:7683:14
    7683     export { editorLocalization, defaultStrings } from "editorLocalization";
                      ~~~~~~~~~~~~~~~~~~
    'editorLocalization' was also declared here.

node_modules/survey-creator-react/survey-creator-react.d.ts:787:34 - error TS2300: Duplicate identifier 'localization'.

787     export { editorLocalization, localization } from "survey-creator-core";
                                     ~~~~~~~~~~~~

  node_modules/survey-creator-core/survey-creator-core.d.ts:7684:36
    7684     export { editorLocalization as localization } from "editorLocalization";
                                            ~~~~~~~~~~~~

792     export { ISurveyCreatorOptions, IPropertyGridEditor } from "survey-creator-core";
                                        ~~~~~~~~~~~~~~~~~~~

node_modules/survey-creator-react/survey-creator-react.d.ts:793:14 - error TS2303: Circular definition of import alias 'ToolboxToolViewModel'.

793     export { ToolboxToolViewModel, PropertyGridEditorCollection } from "survey-creator-core";
                 ~~~~~~~~~~~~~~~~~~~~

node_modules/survey-creator-react/survey-creator-react.d.ts:793:36 - error TS2303: Circular definition of import alias 'PropertyGridEditorCollection'.

793     export { ToolboxToolViewModel, PropertyGridEditorCollection } from "survey-creator-core";
                                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/survey-creator-react/survey-creator-react.d.ts:794:14 - error TS2303: Circular definition of import alias 'StylesManager'.

794     export { StylesManager } from "survey-creator-core";
                 ~~~~~~~~~~~~~


Found 17 errors in 2 files.

Errors  Files
     3  node_modules/survey-creator-core/survey-creator-core.d.ts:7681
    14  node_modules/survey-creator-react/survey-creator-react.d.ts:743

What is the expected behavior?

These errors should not appear.

How would you reproduce the current behavior (if this is a bug)?

Create a new react project with npx create-react-app my-app --template typescript

Install survey-creator-react with npm i survey-creator-react

Open app.tsx in the /src/ folder and import SurveyCreator by adding the line

import { SurveyCreator } from 'survey-creator-react';

Open tsconfig.json and remove the "skipLibCheck": true line

Run tsc in a terminal to compile the app.

Type errors from survey-creator-react and survey-creator-core will appear.

Provide the test code and the tested page URL (if applicable)

Specify your

  • browser: Latest version of Edge (But that is not used)
  • editor version: VS Code 1.76.1
  • SurveyJS Creator version: 1.9.77
  • node version: 14.20.1
tsv2013 wrote this answer on 2023-03-28

I've followed your steps and got the attached app. It compiles and runs for me ok.
my-app.zip

Can you check the app and point me what to do to reproduce the issue?

nicklasbns wrote this answer on 2023-03-28

Thank you for reaching back!
I downloaded your zip and extracted it, ran npm install and tsc and immediately got the same errors.
The only difference i saw here was that when running npm install there is a warning saying:

npm WARN old lockfile
npm WARN old lockfile The package-lock.json file was created with an old version of npm,
npm WARN old lockfile so supplemental metadata must be fetched from the registry.
npm WARN old lockfile
npm WARN old lockfile This is a one-time fix-up, please be patient...
npm WARN old lockfile

I tried running it both on my windows computer and on a linux vm with the same results.
My npm version is 9.6.2

More Details About Repo
Owner Name surveyjs
Repo Name survey-creator
Full Name surveyjs/survey-creator
Language TypeScript
Created Date 2015-12-22
Updated Date 2023-03-30
Star Count 683
Watcher Count 29
Fork Count 308
Issue Count 301

YOU MAY BE INTERESTED

Issue Title Created Date Updated Date