I am currently working with the following files:
tsconfig.json
{
"compilerOptions": {
"lib": [
"es2019",
"dom"
],
"target": "es5",
"module": "system",
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"outFile": "bundle.js"
},
"files": ["index.ts"]
}
Package.json
{
"name": "testol",
"version": "1.0.0",
"description": "",
"main": "bundle.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"ol": "^5.3.3",
"@types/ol": "^5.3.6"
},
"devDependencies": {
"typescript": "^3.6.4"
}
}
index.ts
import GeoJSON from 'ol/format/GeoJSON';
const geoJSON = new GeoJSON();
Upon running tsc --build tsconfig.json
, I encounter several errors like
node_modules/@types/ol/format/GeoJSON.d.ts:1:10 - error TS2305: Module '"node_modules/@types/ol/format/GeoJSON"' has no exported member 'Feature'.
1 import { Feature, FeatureCollection, GeoJSON as GeoJSON_1, Geometry, GeometryCollection, LineString, MultiLineString, MultiPoint, MultiPolygon, Point, Polygon } from 'geojson';
~~~~~~~
node_modules/@types/ol/format/GeoJSON.d.ts:1:19 - error TS2305: Module '"node_modules/@types/ol/format/GeoJSON"' has no exported member 'FeatureCollection'.
1 import { Feature, FeatureCollection, GeoJSON as GeoJSON_1, Geometry, GeometryCollection, LineString, MultiLineString, MultiPoint, MultiPolygon, Point, Polygon } from 'geojson';
~~~~~~~~~~~~~~~~~
What seems to be the issue here? I attempted to install an older version of @types/geojson as advised here