I have a devenvironment setup for Sharepoint 2019/SPSE and i can create webparts but have problem when using d3.js. Adding import * as d3 from 'd3'
generates a bunch of type-errors when running gulp build. (sample below of errors).
Error - typescript - node_modules\@types\d3-array\index.d.ts(35,79): error TS1005: ';' expected.
[12:05:27] Error - typescript - node_modules\@types\d3-array\index.d.ts(35,94): error TS1005: ',' expected.
[12:05:27] Error - typescript - node_modules\@types\d3-array\index.d.ts(48,13): error TS1005: ')' expected.
[12:05:27] Error - typescript - node_modules\@types\d3-scale-chromatic\index.d.ts(40,34): error TS1005: '=' expected.
Checking file with error the syntax is correct.
I have tried older version of d3 and d3types. Specifying a specific d3 function in d3 import. Still get error from functions that isn't imported, ex d3-array.
if i click on a error in console like: Error - typescript - node_modules/@types/d3-scale-chromatic/index.d.ts(8,40): error TS1005: '=' expected. It seems to have no relation to the error described.
Rows from 1 - 8 looks like this:
Problem solved. Even though its solved the main problem is the fact its almost not possible to develope spfx-solutions for Sharepoint 2019/SE in a proper way.
Versions is stuck back in 2018, a build generates about 800 varnings for vulnerabilities/deprecated modules. MS has no intention to update spfx for on premise Sharepoint :-(
My dirty fix was to install older versions of types-files aimed for TS 2.4