我有一个由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'"]
}
})
);
链接到功能策略(属于Helmet软件包):https://helmetjs.github.io/docs/feature-policy/