javascript - TS2339:“头盔”类型上不存在属性“featurePolicy”
问题描述
我有由Helmet定义的安全规则的应用程序。但是,安装时@types/helmet
出现以下错误TS2339: Property 'featurePolicy' does not exist on type 'Helmet'.
。代码如下:
import * as express from 'express';
import * as helmet from 'helmet';
import { Express } from 'express';
const expressApp: Express = express(); // Create Express instance.
// Limit website features by implementing Feature Policy.
expressApp.use(
helmet.featurePolicy({
features: {
fullscreen: ["'self'"],
payment: ["'none'"],
syncXhr: ["'none'"]
}
})
);
链接到功能策略,它是头盔包的一部分:https ://helmetjs.github.io/docs/feature-policy/
解决方案
推荐阅读
- vue.js - async vuex fetch action state filled if using variable in template getting error undefined
- python - 从循环中更改多个屏幕的 kivy 小部件属性
- django - django - 将多个实例传递给表单并将其保存在数据库中
- java - 如何在persistence.xml 中设置默认的Eclipselink CacheCoordinateType?
- ios - TableViewCell 仅返回 Nil
- c - C - 什么 *(long *)(host->h_addr); 做?
- android - Android Studio:未编译的 XML 文件作为参数传递?
- unity3d - 将对象旋转到鼠标方向
- c++ - VS2017 15.8.3版本成功编译内联方法不返回必填值
- javascript - 事件循环、队列等是 JavaScript 运行时或引擎的一部分吗?