小编web*_*ial的帖子

错误 TS2339:“FormData”类型上不存在属性“entries”

我在 Stackoverflow 和网络上搜索,我发现这个线程https://github.com/Microsoft/TypeScript/issues/14813但它没有解决我的问题。我在编译我的代码时遇到了这个错误ng serve --watch

错误 TS2339:“FormData”类型上不存在属性“entries”。

这部分fd.entries()触发了错误......知道这里发生了什么吗?

onFileSelected(event) {
    const fd = new FormData;

    for (const file of event.target.files) {
        fd.append('thumbnail', file, file.name);

        const entries = fd.entries();
        // some other methods are called here e. g. upload the images

        for (const pair of entries) {
            fd.delete(pair[0]);
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

我看到那里(https://github.com/Microsoft/TypeScript/blob/master/src/lib/dom.iterable.d.ts)是一些接口,entries但不知何故这对我不起作用。

编辑

我的tsconfig.json看起来像这样

{
    "compileOnSave": false,
    "compilerOptions": {
        "outDir": "./dist/out-tsc",
        "sourceMap": true,
        "declaration": false,
        "moduleResolution": "node",
        "emitDecoratorMetadata": true, …
Run Code Online (Sandbox Code Playgroud)

typescript tslint angular

10
推荐指数
3
解决办法
1万
查看次数

将复杂的 SQL 查询转换为 SQLAlchemy

我的想法用完了。我现在用谷歌搜索超过一天,但我仍然找不到任何有用的答案来解决我的问题。

到目前为止我所做的,我尝试使用原始 SQL 但没有运气。

locations = db.session.query(Location, select([text('( 6371 * acos( cos( radians("53.6209798282177") ) * cos( radians( lat ) ) * cos( radians( lng ) - radians("13.96948162900808") ) + sin( radians("53.6209798282177") ) * sin( radians( lat ) ) ) )')]).label('distance')).having('distance' < 25).all()
Run Code Online (Sandbox Code Playgroud)

使用此原始 SQL 查询时mysql,返回的结果为零,但在其中运行相同的查询时,返回正确的结果。

此外,我还发现,在将查询打印到终端时,它无法HAVING()正确处理该子句。

我的查询在打印时如下所示:

SELECT location.id AS location_id, location.created_date AS location_created_date, location.zip AS location_zip, location.user_id AS location_user_id, location.lat AS location_lat, location.lng AS location_lng, location.city AS location_city 
FROM location 
HAVING false = 1
Run Code Online (Sandbox Code Playgroud)

如何将此 …

python mysql sqlalchemy geospatial

4
推荐指数
1
解决办法
1314
查看次数

运行 ng build --prod 时传单标记图标 url 编译错误

出于某种原因,ng build --prod在运行ng buildLeaflet 标记图标 url时,传单标记图标 url在运行时编译错误。

我的环境:

Angular CLI: 7.0.5
Node: 11.2.0
OS: linux x64
Angular: 7.0.3
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.10.5
@angular-devkit/build-angular     0.10.5
@angular-devkit/build-optimizer   0.10.5
@angular-devkit/build-webpack     0.10.5
@angular-devkit/core              7.0.5
@angular-devkit/schematics        7.0.5
@angular/cli                      7.0.5
@ngtools/webpack                  7.0.5
@schematics/angular               7.0.5
@schematics/update                0.10.5
rxjs                              6.3.3
typescript                        3.1.6
webpack                           4.19.1
Run Code Online (Sandbox Code Playgroud)

您可以在此网址下找到 prod env

屏幕截图显示了错误编译的图标标记 url 的示例。

ng build --prod 时,传单标记图标 url 编译错误

我想这与Leaflet上的这个问题有关,但我不知道如何解决这个问题。

leaflet webpack angular ngx-leaflet

4
推荐指数
1
解决办法
1643
查看次数