TS2339:属性“ featurePolicy”在类型“头盔”上不存在

时间:2019-08-14 15:32:31

标签: javascript typescript express typescript-typings helmet.js

我有一个由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/

0 个答案:

没有答案