dispatchEvent.d.ts issue

1 Answer 132 Views
Dialog
Mark
Top achievements
Rank 1
Iron
Mark asked on 01 Dec 2021, 02:47 PM

When compiling my SpFx web part I receive the following errors:

[08:59:40] Error - [tsc] node_modules/@progress/kendo-react-common/dist/npm/events/dispatchEvent.d.ts(15,252): error TS1005: ',' expected.
[08:59:40] Error - [tsc] node_modules/@progress/kendo-react-common/dist/npm/events/dispatchEvent.d.ts(15,268): error TS1005: '=' expected.
[08:59:40] Error - [tsc] node_modules/@progress/kendo-react-common/dist/npm/events/dispatchEvent.d.ts(15,278): error TS1005: ',' expected.
[08:59:40] Error - [tsc] node_modules/@progress/kendo-react-common/dist/npm/events/dispatchEvent.d.ts(15,284): error TS1005: '=' expected.
[08:59:40] Error - [tsc] node_modules/@progress/kendo-react-common/dist/npm/events/dispatchEvent.d.ts(15,286): error TS1005: '>' expected.
[08:59:40] Error - [tsc] node_modules/@progress/kendo-react-common/dist/npm/events/dispatchEvent.d.ts(15,295): error TS1005: '=' expected.
[08:59:40] Error - [tsc] node_modules/@progress/kendo-react-common/dist/npm/events/dispatchEvent.d.ts(15,303): error TS1005: '>' expected.
[08:59:40] Error - [tsc] node_modules/@progress/kendo-react-common/dist/npm/events/dispatchEvent.d.ts(15,311): error TS1005: '=' expected.
[08:59:40] Error - [tsc] node_modules/@progress/kendo-react-common/dist/npm/events/dispatchEvent.d.ts(15,339): error TS1109: Expression expected.
[08:59:40] Error - [tsc] node_modules/@progress/kendo-react-dialogs/node_modules/@progress/kendo-react-common/dist/npm/events/dispatchEvent.d.ts(15,252): error TS1005: ',' expected.
[08:59:40] Error - [tsc] node_modules/@progress/kendo-react-dialogs/node_modules/@progress/kendo-react-common/dist/npm/events/dispatchEvent.d.ts(15,268): error TS1005: '=' expected.
[08:59:40] Error - [tsc] node_modules/@progress/kendo-react-dialogs/node_modules/@progress/kendo-react-common/dist/npm/events/dispatchEvent.d.ts(15,278): error TS1005: ',' expected.
[08:59:40] Error - [tsc] node_modules/@progress/kendo-react-dialogs/node_modules/@progress/kendo-react-common/dist/npm/events/dispatchEvent.d.ts(15,284): error TS1005: '=' expected.
[08:59:40] Error - [tsc] node_modules/@progress/kendo-react-dialogs/node_modules/@progress/kendo-react-common/dist/npm/events/dispatchEvent.d.ts(15,286): error TS1005: '>' expected.
[08:59:40] Error - [tsc] node_modules/@progress/kendo-react-dialogs/node_modules/@progress/kendo-react-common/dist/npm/events/dispatchEvent.d.ts(15,295): error TS1005: '=' expected.
[08:59:40] Error - [tsc] node_modules/@progress/kendo-react-dialogs/node_modules/@progress/kendo-react-common/dist/npm/events/dispatchEvent.d.ts(15,303): error TS1005: '>' expected.
[08:59:40] Error - [tsc] node_modules/@progress/kendo-react-dialogs/node_modules/@progress/kendo-react-common/dist/npm/events/dispatchEvent.d.ts(15,311): error TS1005: '=' expected.
[08:59:40] Error - [tsc] node_modules/@progress/kendo-react-dialogs/node_modules/@progress/kendo-react-common/dist/npm/events/dispatchEvent.d.ts(15,339): error TS1109: Expression expected.
[08:59:40] Error - 'tsc' sub task errored after 2.75 s 
 exited with code 2

In the past I've updated the out of the box dispatch code (one line) but can't find where it was posted on this forum. Any assistance with this is greatly appreciated. Thank you

1 Answer, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 02 Dec 2021, 06:00 AM

Hello,

This looks like an error that can occur because of the source maps. Please try the solution suggested here and advise if the issue still occurs:

https://www.telerik.com/kendo-react-ui/components/integration/sharepoint-spfx/#toc-error-occurs-during-build-time

Regards,
Stefan
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Mark
Top achievements
Rank 1
Iron
commented on 02 Dec 2021, 01:02 PM

I already had that in my gulp.js file. Any other ideas?

Someone else provided an answer on these forums a few years ago but I cannot find it. I basically had to adjust the code in the dispatchEvent.d.ts files. The current code is as follows:


 export default function dispatchEvent<E extends BaseEvent<React.Component>>(eventHandler: ((event: E) => void) | undefined, dispatchedEvent: React.SyntheticEvent<any>, target: E['target'], eventData: Exclude<keyof E, keyof BaseEvent<React.Component>>, extends never ? undefined : Pick<E, Exclude<keyof E, keyof BaseEvent<React.Component>>>): void;

Thanks for the reply.

Stefan
Telerik team
commented on 02 Dec 2021, 02:57 PM

Hello,

Thank you for the confirmation.

Based on the reports we had one of the possible things could be:

1) React and ReactDOm versions are not 16 or up.

2) The typings of these packages are not the same version. Packages like '@types/react'.

3) Version for Spfx is not 1.7 or up.

Sharing the package.json with us can be helpful in order to see all used versions in the application.

Mark
Top achievements
Rank 1
Iron
commented on 07 Feb 2022, 02:53 PM

{
  "name": "otdmp-web-parts-coordinator-dashboard",
  "version": "0.0.1",
  "private": true,
  "engines": {
    "node": ">=0.10.0"
  },
  "scripts": {
    "build": "gulp bundle",
    "clean": "gulp clean",
    "test": "gulp test"
  },
  "dependencies": {
    "@microsoft/sp-core-library": "1.7.1",
    "@microsoft/sp-lodash-subset": "1.7.1",
    "@microsoft/sp-office-ui-fabric-core": "1.7.1",
    "@microsoft/sp-webpart-base": "1.7.1",
    "@progress/kendo-data-query": "^1.5.1",
    "@progress/kendo-react-buttons": "^3.2.2",
    "@progress/kendo-react-dateinputs": "^3.2.2",
    "@progress/kendo-react-dialogs": "^3.6.0",
    "@progress/kendo-react-dropdowns": "^3.2.2",
    "@progress/kendo-react-excel-export": "^3.14.0",
    "@progress/kendo-react-grid": "^3.2.2",
    "@progress/kendo-react-inputs": "^3.2.2",
    "@progress/kendo-react-intl": "^3.2.2",
    "@progress/kendo-react-layout": "^3.2.2",
    "@progress/kendo-react-popup": "^3.2.2",
    "@progress/kendo-theme-default": "^4.1.0",
    "@types/es6-promise": "0.0.33",
    "@types/react": "16.4.2",
    "@types/react-dom": "16.0.5",
    "@types/webpack-env": "1.13.1",
    "moment": "^2.24.0",
    "react": "16.3.2",
    "react-dom": "16.3.2"
  },
  "resolutions": {
    "@types/react": "16.4.2"
  },
  "devDependencies": {
    "@microsoft/sp-build-web": "1.7.1",
    "@microsoft/sp-tslint-rules": "1.7.1",
    "@microsoft/sp-module-interfaces": "1.7.1",
    "@microsoft/sp-webpart-workbench": "1.7.1",
    "gulp": "~3.9.1",
    "@types/chai": "3.4.34",
    "@types/mocha": "2.2.38",
    "ajv": "~5.2.2"
  }
}
Stefan
Telerik team
commented on 08 Feb 2022, 05:44 AM

Hello,

Thank you for the package.json.

I see that there are differences in the version of React and ReactDOM and the typings for those packages:

    "react": "16.3.2",
    "react-dom": "16.3.2"

    "@types/react": "16.4.2",
    "@types/react-dom": "16.0.5",

Please ensure that the packages and their typing are the same versions.
Mark
Top achievements
Rank 1
Iron
commented on 16 May 2023, 03:07 PM

I'm having this issue once again. My versions look good. See package.jons inline:

 


{
  "name": "web-parts-collaboration",
  "version": "0.0.1",
  "private": true,
  "engines": {
    "node": ">=0.10.0"
  },
  "scripts": {
    "build": "gulp bundle",
    "clean": "gulp clean",
    "test": "gulp test"
  },
  "dependencies": {
    "@microsoft/sp-core-library": "1.7.1",
    "@microsoft/sp-lodash-subset": "1.7.1",
    "@microsoft/sp-office-ui-fabric-core": "1.7.1",
    "@microsoft/sp-webpart-base": "1.7.1",
    "@progress/kendo-data-query": "^1.5.2",
    "@progress/kendo-react-buttons": "^4.0.0",
    "@progress/kendo-react-dateinputs": "^4.0.0",
    "@progress/kendo-react-dialogs": "^4.1.0",
    "@progress/kendo-react-dropdowns": "^4.1.0",
    "@progress/kendo-react-grid": "^4.1.0",
    "@progress/kendo-react-inputs": "^4.0.0",
    "@progress/kendo-react-intl": "^4.0.0",
    "@progress/kendo-react-layout": "^3.3.0",
    "@progress/kendo-theme-default": "^4.2.0",
    "@types/es6-promise": "0.0.33",
    "@types/react-dom": "16.8.0",
    "@types/webpack-env": "1.13.1",
    "moment": "^2.24.0",
    "react": "^16.8.2",
    "react-dom": "^16.8.0",
    "typescript": "^2.4.1"
  },
  "resolutions": {
    "@types/react": "16.8.2"
  },
  "devDependencies": {
    "@microsoft/sp-build-web": "^1.7.1",
    "@microsoft/sp-module-interfaces": "1.7.1",
    "@microsoft/sp-tslint-rules": "1.7.1",
    "@microsoft/sp-webpart-workbench": "^1.7.1",
    "@types/chai": "3.4.34",
    "@types/mocha": "2.2.38",
    "ajv": "~5.2.2",
    "gulp": "~3.9.1"
  }
}

And here's the errors I'm receiving:


[11:01:07] Error - [tsc] node_modules/@progress/kendo-react-common/dist/npm/events/dispatchEvent.d.ts(15,252): error TS1005: ',' expected.
[11:01:07] Error - [tsc] node_modules/@progress/kendo-react-common/dist/npm/events/dispatchEvent.d.ts(15,268): error TS1005: '=' expected.
[11:01:07] Error - [tsc] node_modules/@progress/kendo-react-common/dist/npm/events/dispatchEvent.d.ts(15,278): error TS1005: ',' expected.
[11:01:08] Error - [tsc] node_modules/@progress/kendo-react-common/dist/npm/events/dispatchEvent.d.ts(15,284): error TS1005: '=' expected.
[11:01:08] Error - [tsc] node_modules/@progress/kendo-react-common/dist/npm/events/dispatchEvent.d.ts(15,286): error TS1005: '>' expected.
[11:01:08] Error - [tsc] node_modules/@progress/kendo-react-common/dist/npm/events/dispatchEvent.d.ts(15,295): error TS1005: '=' expected.
[11:01:08] Error - [tsc] node_modules/@progress/kendo-react-common/dist/npm/events/dispatchEvent.d.ts(15,303): error TS1005: '>' expected.
[11:01:08] Error - [tsc] node_modules/@progress/kendo-react-common/dist/npm/events/dispatchEvent.d.ts(15,311): error TS1005: '=' expected.
[11:01:08] Error - [tsc] node_modules/@progress/kendo-react-common/dist/npm/events/dispatchEvent.d.ts(15,339): error TS1109: Expression expected.
[11:01:08] Error - [tsc] node_modules/@progress/kendo-react-dateinputs/node_modules/@progress/kendo-react-common/dist/npm/events/dispatchEvent.d.ts(15,293): error TS1005: ',' expected.
[11:01:08] Error - [tsc] node_modules/@progress/kendo-react-dateinputs/node_modules/@progress/kendo-react-common/dist/npm/events/dispatchEvent.d.ts(15,309): error TS1005: '=' expected.
[11:01:08] Error - [tsc] node_modules/@progress/kendo-react-dateinputs/node_modules/@progress/kendo-react-common/dist/npm/events/dispatchEvent.d.ts(15,319): error TS1005: ',' expected.
[11:01:08] Error - [tsc] node_modules/@progress/kendo-react-dateinputs/node_modules/@progress/kendo-react-common/dist/npm/events/dispatchEvent.d.ts(15,325): error TS1005: '=' expected.
[11:01:08] Error - [tsc] node_modules/@progress/kendo-react-dateinputs/node_modules/@progress/kendo-react-common/dist/npm/events/dispatchEvent.d.ts(15,327): error TS1005: '>' expected.
[11:01:08] Error - [tsc] node_modules/@progress/kendo-react-dateinputs/node_modules/@progress/kendo-react-common/dist/npm/events/dispatchEvent.d.ts(15,336): error TS1005: '=' expected.
[11:01:08] Error - [tsc] node_modules/@progress/kendo-react-dateinputs/node_modules/@progress/kendo-react-common/dist/npm/events/dispatchEvent.d.ts(15,344): error TS1005: '>' expected.
[11:01:08] Error - [tsc] node_modules/@progress/kendo-react-dateinputs/node_modules/@progress/kendo-react-common/dist/npm/events/dispatchEvent.d.ts(15,352): error TS1005: '=' expected.
[11:01:08] Error - [tsc] node_modules/@progress/kendo-react-dateinputs/node_modules/@progress/kendo-react-common/dist/npm/events/dispatchEvent.d.ts(15,391): error TS1109: Expression expected.
[11:01:08] Error - [tsc] node_modules/@progress/kendo-react-dialogs/node_modules/@progress/kendo-react-common/dist/npm/events/dispatchEvent.d.ts(15,293): error TS1005: ',' expected.
[11:01:08] Error - [tsc] node_modules/@progress/kendo-react-dialogs/node_modules/@progress/kendo-react-common/dist/npm/events/dispatchEvent.d.ts(15,309): error TS1005: '=' expected.
[11:01:08] Error - [tsc] node_modules/@progress/kendo-react-dialogs/node_modules/@progress/kendo-react-common/dist/npm/events/dispatchEvent.d.ts(15,319): error TS1005: ',' expected.
[11:01:08] Error - [tsc] node_modules/@progress/kendo-react-dialogs/node_modules/@progress/kendo-react-common/dist/npm/events/dispatchEvent.d.ts(15,325): error TS1005: '=' expected.
[11:01:08] Error - [tsc] node_modules/@progress/kendo-react-dialogs/node_modules/@progress/kendo-react-common/dist/npm/events/dispatchEvent.d.ts(15,327): error TS1005: '>' expected.
[11:01:08] Error - [tsc] node_modules/@progress/kendo-react-dialogs/node_modules/@progress/kendo-react-common/dist/npm/events/dispatchEvent.d.ts(15,336): error TS1005: '=' expected.
[11:01:08] Error - [tsc] node_modules/@progress/kendo-react-dialogs/node_modules/@progress/kendo-react-common/dist/npm/events/dispatchEvent.d.ts(15,344): error TS1005: '>' expected.
[11:01:08] Error - [tsc] node_modules/@progress/kendo-react-dialogs/node_modules/@progress/kendo-react-common/dist/npm/events/dispatchEvent.d.ts(15,352): error TS1005: '=' expected.
[11:01:08] Error - [tsc] node_modules/@progress/kendo-react-dialogs/node_modules/@progress/kendo-react-common/dist/npm/events/dispatchEvent.d.ts(15,391): error TS1109: Expression expected.
[11:01:08] Error - [tsc] node_modules/@progress/kendo-react-grid/node_modules/@progress/kendo-react-common/dist/npm/events/dispatchEvent.d.ts(15,293): error TS1005: ',' expected.
[11:01:08] Error - [tsc] node_modules/@progress/kendo-react-grid/node_modules/@progress/kendo-react-common/dist/npm/events/dispatchEvent.d.ts(15,309): error TS1005: '=' expected.
[11:01:08] Error - [tsc] node_modules/@progress/kendo-react-grid/node_modules/@progress/kendo-react-common/dist/npm/events/dispatchEvent.d.ts(15,319): error TS1005: ',' expected.
[11:01:08] Error - [tsc] node_modules/@progress/kendo-react-grid/node_modules/@progress/kendo-react-common/dist/npm/events/dispatchEvent.d.ts(15,325): error TS1005: '=' expected.
[11:01:08] Error - [tsc] node_modules/@progress/kendo-react-grid/node_modules/@progress/kendo-react-common/dist/npm/events/dispatchEvent.d.ts(15,327): error TS1005: '>' expected.
[11:01:08] Error - [tsc] node_modules/@progress/kendo-react-grid/node_modules/@progress/kendo-react-common/dist/npm/events/dispatchEvent.d.ts(15,336): error TS1005: '=' expected.
[11:01:08] Error - [tsc] node_modules/@progress/kendo-react-grid/node_modules/@progress/kendo-react-common/dist/npm/events/dispatchEvent.d.ts(15,344): error TS1005: '>' expected.
[11:01:08] Error - [tsc] node_modules/@progress/kendo-react-grid/node_modules/@progress/kendo-react-common/dist/npm/events/dispatchEvent.d.ts(15,352): error TS1005: '=' expected.
[11:01:08] Error - [tsc] node_modules/@progress/kendo-react-grid/node_modules/@progress/kendo-react-common/dist/npm/events/dispatchEvent.d.ts(15,391): error TS1109: Expression expected.
[11:01:08] Error - [tsc] node_modules/@progress/kendo-react-inputs/node_modules/@progress/kendo-react-common/dist/npm/events/dispatchEvent.d.ts(15,293): error TS1005: 
',' expected.
[11:01:08] Error - [tsc] node_modules/@progress/kendo-react-inputs/node_modules/@progress/kendo-react-common/dist/npm/events/dispatchEvent.d.ts(15,309): error TS1005: 
'=' expected.
[11:01:08] Error - [tsc] node_modules/@progress/kendo-react-inputs/node_modules/@progress/kendo-react-common/dist/npm/events/dispatchEvent.d.ts(15,319): error TS1005: 
',' expected.
[11:01:08] Error - [tsc] node_modules/@progress/kendo-react-inputs/node_modules/@progress/kendo-react-common/dist/npm/events/dispatchEvent.d.ts(15,325): error TS1005: 
'=' expected.
[11:01:08] Error - [tsc] node_modules/@progress/kendo-react-inputs/node_modules/@progress/kendo-react-common/dist/npm/events/dispatchEvent.d.ts(15,327): error TS1005: 
'>' expected.
[11:01:08] Error - [tsc] node_modules/@progress/kendo-react-inputs/node_modules/@progress/kendo-react-common/dist/npm/events/dispatchEvent.d.ts(15,336): error TS1005: 
'=' expected.
[11:01:08] Error - [tsc] node_modules/@progress/kendo-react-inputs/node_modules/@progress/kendo-react-common/dist/npm/events/dispatchEvent.d.ts(15,344): error TS1005: 
'>' expected.
[11:01:08] Error - [tsc] node_modules/@progress/kendo-react-inputs/node_modules/@progress/kendo-react-common/dist/npm/events/dispatchEvent.d.ts(15,352): error TS1005: 
'=' expected.
[11:01:08] Error - [tsc] node_modules/@progress/kendo-react-inputs/node_modules/@progress/kendo-react-common/dist/npm/events/dispatchEvent.d.ts(15,391): error TS1109: 
Expression expected.
[11:01:08] Error - 'tsc' sub task errored after 6.04 s
 exited with code 2

Here is the contents of one of the dispatchEvents.d.ts files:


/// <reference types="react" />
import { BaseEvent } from './BaseEvent';
/**
 * @hidden
 * Dispatches a new event bsed on an event that was already internally dispatched to KendoReact users.
 *
 * @param eventHandler - The public event handler that is assigned by the user.
 * When undefined, the method is not an option.
 * @param dispatchedEvent - The event that was already dispatched internally.
 * @param target - The target component of the new event.
 * @param eventData - The additional data that will be passed through the new event.
 * When the new event has no additional data
 *  other than the `BaseEvent` arguments, pass `undefined`.
 */
export default function dispatchEvent<E extends BaseEvent<React.Component>>(eventHandler: ((event: E) => void) | undefined, dispatchedEvent: React.SyntheticEvent<any>, target: E['target'], eventData: Exclude<keyof E, keyof BaseEvent<React.Component>> extends never ? undefined : Pick<E, Exclude<keyof E, keyof BaseEvent<React.Component>>>): void;
//export declare function dispatchEvent<E extends BaseEvent<React.Component | FCHandle>, FCHandle = object>(eventHandler: ((event: E) => void) | undefined, dispatchedEvent: React.SyntheticEvent<any>, target: E['target'], eventData: Exclude<keyof E, keyof BaseEvent<React.Component | FCHandle>> extends never ? undefined : Pick<E, Exclude<keyof E, keyof BaseEvent<React.Component | FCHandle>>>): void;

Please advise as to what you think may be the issue. Thank you

 

Vessy
Telerik team
commented on 18 May 2023, 01:20 PM | edited

Hi, Mark,

Thanks a lot for the provided files. I inspected them and noticed several things that could possibly lead to the thrown errors:

  1. The react versions are different, make sure that all of them are targeting the same value (either with, or withough `^` in front of the version):
        "@types/react-dom": "^16.8.0",
        "react": "^16.8.2",
        "react-dom": "^16.8.0",
      ...
        "@types/react": "^16.8.2"
  2. The installed KendoReact packages have different major version, make sure that all of them are upgraded to the same one, e.g. "^4.0.0"
  3. Upgrade the typescript version to "~3.3.0"  (this was the version used in the "^4.0.0" version of the KendoReact components.

Please, go through all points above and let me know if the errors persist after updating them.

 

Tags
Dialog
Asked by
Mark
Top achievements
Rank 1
Iron
Answers by
Stefan
Telerik team
Share this question
or