Encountering an error message in one of my projects:
test/node_modules/@types/leaflet/index.d.ts(856,11): error TS2415: Class 'GeoJSON' incorrectly extends base class 'FeatureGroup'.
Types of property 'setStyle' are incompatible.
Type '(style: StyleFunction) => this' is not assignable to type '(style: PathOptions) => this'.
Types of parameters 'style' and 'style' are incompatible.
Type 'PathOptions' is not assignable to type 'StyleFunction'.
Type 'PathOptions' provides no match for the signature '(feature?: Feature<GeometryObject>): PathOptions'.
The input files are as follows:
test.ts
import { LatLngExpression } from 'leaflet'
package.json
{
"name": "test",
"version": "0.0.1",
"description": "",
"author": "",
"license": "ISC",
"devDependencies": {
"@types/leaflet": "^1.0.68",
"gulp": "^3.9.1",
"gulp-typescript": "^3.2.2",
"typescript": "^2.4.2"
}
}
tsconfig.json
{
"compileOnSave": true,
"compilerOptions": {
"noEmitOnError": true,
"target": "es5",
"module": "amd",
"moduleResolution": "node"
},
"include": [
"test.ts"
]
}
gulpfile.js
const gulp = require('gulp');
const ts = require("gulp-typescript");
const tsProject = ts.createProject("tsconfig.json");
gulp.task('default', () => {
const tsResult = tsProject.src().pipe(tsProject());
return tsResult.js.pipe(gulp.dest(''));
});
The error occurs when running "yarn && gulp" but not with "npm install" or "tsc -p .". The issue only surfaced after upgrading to Typescript 2.4.2 from 2.4.1.
I am unsure which component is at fault: yarn, typescript, gulp-typescript, or @types/leaflet. Any suggestions on how to address this?
This test case is extracted from a larger project where I prefer using "yarn && gulp", so seeking a fix rather than workarounds.