angular - 错误 TS2416:“MockMatchMedia”类型中的属性“_registry”
问题描述
将我的 Angular 6.1 应用程序更新到 Angular 7后,出现以下错误ng serve
:
ERROR in node_modules/@angular/flex-layout/core/typings/match-media/mock/mock-match-media.d.ts(25,15): error TS2416: Property '_registry' in type 'MockMatchMedia' is not assignable to the same property in base type 'MatchMedia'.
Type 'Map<string, MockMediaQueryList>' is not assignable to type 'Map<string, MediaQueryList>'.
Type 'MockMediaQueryList' is not assignable to type 'MediaQueryList'.
Property 'onchange' is missing in type 'MockMediaQueryList'.
node_modules/@angular/flex-layout/core/typings/match-media/mock/mock-match-media.d.ts(63,22): error TS2420: Class 'MockMediaQueryList' incorrectly implements interface 'MediaQueryList'.
Property 'onchange' is missing in type 'MockMediaQueryList'.
node_modules/@angular/flex-layout/core/typings/match-media/mock/mock-match-media.d.ts(80,27): error TS2304: Cannot find name 'MediaQueryListListener'.
node_modules/@angular/flex-layout/core/typings/match-media/mock/mock-match-media.d.ts(82,23): error TS2304: Cannot find name 'MediaQueryListListener'.
node_modules/@angular/flex-layout/core/typings/match-media/server-match-media.d.ts(11,22): error TS2420: Class 'ServerMediaQueryList' incorrectly implements interface 'MediaQueryList'.
Property 'onchange' is missing in type 'ServerMediaQueryList'.
node_modules/@angular/flex-layout/core/typings/match-media/server-match-media.d.ts(28,27): error TS2304: Cannot find name 'MediaQueryListListener'.
node_modules/@angular/flex-layout/core/typings/match-media/server-match-media.d.ts(30,23): error TS2304: Cannot find name 'MediaQueryListListener'.
node_modules/@angular/flex-layout/core/typings/match-media/server-match-media.d.ts(42,15): error TS2416: Property '_registry' in type 'ServerMatchMedia' is not assignable to the same property in base type 'MatchMedia'.
Type 'Map<string, ServerMediaQueryList>' is not assignable to type 'Map<string, MediaQueryList>'.
Type 'ServerMediaQueryList' is not assignable to type 'MediaQueryList'.
Property 'onchange' is missing in type 'ServerMediaQueryList'.
node_modules/@angular/flex-layout/core/typings/match-media/server-match-media.d.ts(54,15): error TS2416: Property '_buildMQL' in type 'ServerMatchMedia' is not assignable to the same property in base type 'MatchMedia'.
Type '(query: string) => ServerMediaQueryList' is not assignable to type '(query: string) => MediaQueryList'.
Type 'ServerMediaQueryList' is not assignable to type 'MediaQueryList'.
解决方案
更新到@angular/flex-layout 7.0.0-beta.19
或更好:
npm install @angular/flex-layout@^7.0.0-beta.19
无需报告;这是一个已知问题。
推荐阅读
- python - 对嵌套的元组列表中的重复计数求和
- python-3.x - 在 Django 中使用 ajax 显示更多评论
- javascript - 我该如何解决这个 mongodb 错误?: MongoError: 'energy.$cond' 中的美元 ($) 前缀字段 '$cond' 对存储无效
- ruby-on-rails - RSpec 邮件程序存根测试邮件是否已发送
- logging - 记录“调试”级别在任何项目中都不起作用
- ruby-on-rails - 如何将 @babel/preset-react 添加到 babel.config.js 的预设部分
- dataweave - Patch data with DataWeave
- typescript - 是的,使用打字稿在嵌套对象中进行条件验证
- android - android:在某个位置滚动的按钮
- reactjs - 使用 createEntityAdapter 时,每个 React 组件都应该有自己的切片吗?