在我的項目,我收到此錯誤信息:類 'GeoJSON的' 不正確擴展基類FeatureGroup「
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'.
以下是輸入文件:
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(''));
});
如果我執行 「紗& &吞掉」 出現錯誤 - 但不是,如果我使用 「故宮安裝」,而不是紗,而不是如果我使用「tsc -p」。而不是吞噬文件。 此外,只要我有Typescript 2.4.1,根本沒有錯誤 - 它在我更新到Typescript 2.4.2後出現。
我想報告這是一個錯誤 - 但我不知道哪個部分是負責任的:紗線,打字稿,吞食打字稿,@ types/leaflet?
我怎麼能得到這個?
很明顯,我從一個更大的項目中提取了這個測試用例,我想用「yarn & & gulp」,這會導致錯誤。所以我想要修正 - 而不是上面的任何「解決方法」。
我確實有同樣的問題,所以我想這個問題應該留下來。 – Tx3