在运行服务时出现flex-layout中的问题

Die*_*eeu 11 flexbox typescript angular

对不起,我尝试过这个链接说我要做什么,但没有任何改变,有人可以帮助我.控制台的错误


node_modules/@angular/flex-layout/core/typings/match-media/mock/mock-match-media.d.ts(25,15)中的错误:错误TS2416:"MockMatchMedia"类型中的属性" 注册表"不是可分配给基本类型"MatchMedia"中的相同属性."地图"类型不能指定为"地图"类型.类型'MockMediaQueryList'不能分配给'MediaQueryList'类型.属性"removeListener"的类型不兼容.类型'(:EventListenerOrEventListenerObject)=> void'不能分配给类型'(listener:MediaQueryListListener)=> void'.参数"_"和"监听器"的类型不兼容.类型'MediaQueryListListener'不能分配给'EventListenerOrEventListenerObject'.类型'MediaQueryListListener'不能分配给'EventListenerObject'类型."MediaQueryListListener"类型中缺少属性"handleEvent".node_modules/@angular/flex-layout/core/typings/match-media/mock/mock-match-media.d.ts(82,5):错误TS2416:"MockMediaQueryList"类型中的属性"removeListener"无法分配给基类型'MediaQueryList'中的相同属性.类型'(:EventListenerOrEventListenerObject)=> void'不能分配给类型'(listener:MediaQueryListListener)=> void'.参数' '和'监听器'的类型不兼容.类型'MediaQueryListListener'不能分配给'EventListenerOrEventListenerObject'.类型'MediaQueryListListener'不能分配给'EventListenerObject'类型.node_modules/@angular/flex-layout/core/typings/match-media/mock/mock-match-media.d.ts(83,38):错误TS2304:找不到名称'MediaQueryListEventMap'.node_modules/@angular/flex-layout/core/typings/match-media/mock/mock-match-media.d.ts(83,99):错误TS2304:找不到名称'MediaQueryListEventMap'.node_modules/@angular/flex-layout/core/typings/match-media/mock/mock-match-media.d.ts(84,41):错误TS2304:找不到名称'MediaQueryListEventMap'.node_modules/@angular/flex-layout/core/typings/match-media/mock/mock-match-media.d.ts(84,102):错误TS2304:找不到名称'MediaQueryListEventMap'.node_modules/@angular/flex-layout/core/typings/match-media/mock/mock-match-media.d.ts(95,67):错误TS2304:找不到名称'MediaQueryListEvent'.node_modules/@angular/flex-layout/core/typings/match-media/server-match-media.d.ts(30,5):错误TS2416:类型'ServerMediaQueryList'中的属性'removeListener'不能分配给它基类型'MediaQueryList'中的属性.类型'(:EventListenerOrEventListenerObject)=> void'不能分配给类型'(listener:MediaQueryListListener)=> void'.参数' '和'监听器'的类型不兼容.类型'MediaQueryListListener'不能分配给'EventListenerOrEventListenerObject'.类型'MediaQueryListListener'不能分配给'EventListenerObject'类型.node_modules/@angular/flex-layout/core/typings/match-media/server-match-media.d.ts(31,38):错误TS2304:找不到名称'MediaQueryListEventMap'.node_modules/@angular/flex-layout/core/typings/match-media/server-match-media.d.ts(31,99):错误TS2304:找不到名称'MediaQueryListEventMap'.node_modules/@angular/flex-layout/core/typings/match-media/server-match-media.d.ts(32,41):错误TS2304:找不到名称'MediaQueryListEventMap'.node_modules/@angular/flex-layout/core/typings/match-media/server-match-media.d.ts(32,102):错误TS2304:找不到名称'MediaQueryListEventMap'.node_modules/@angular/flex-layout/core/typings/match-media/server-match-media.d.ts(46,15):错误TS2416:"ServerMatchMedia"类型中的属性" 注册表"不能分配给它基本类型'MatchMedia'中的属性."地图"类型不能指定为"地图"类型.类型'ServerMediaQueryList'不能分配给'MediaQueryList'类型.属性"removeListener"的类型不兼容.类型'(:EventListenerOrEventListenerObject)=> void'不能分配给类型'(listener:MediaQueryListListener)=> void'.参数"_"和"监听器"的类型不兼容.类型'MediaQueryListListener'不能分配给'EventListenerOrEventListenerObject'.类型'MediaQueryListListener'不能分配给'EventListenerObject'类型.node_modules/@angular/flex-layout/core/typings/match-media/server-match-media.d.ts(58,15):错误TS2416:"ServerMatchMedia"类型中的属性"_buildMQL"不能分配给它基本类型'MatchMedia'中的属性.类型'(query:string)=> ServerMediaQueryList'不能分配给'(query:string)=> MediaQueryList'.类型'ServerMediaQueryList'不能分配给'MediaQueryList'类型.node_modules/@angular/flex-layout/core/typings/match-media/server-match-media.d.ts(60,67):错误TS2304:找不到名称'MediaQueryListEvent'.

Die*_*eeu 15

我找到了一个解决方案,如果有人遇到同样的问题IDK,如果它最好解决,但对我来说这是有效的:

    npm install @angular/flex-layout@6.0.0-beta.18 
Run Code Online (Sandbox Code Playgroud)

  • 在node_modules/@angular/flex-layout/extended/typings/style/style.d.ts中获取错误`ERROR(72,67):错误TS1144:'{'或';' 预期.node_modules/@angular/flex-layout/extended/typings/style/style.d.ts(74,5):错误TS1128:预期的声明或声明.node_modules/@angular/flex-layout/extended/typings/style/style.d.ts(74,33):错误TS1005:';' 预期.node_modules/@angular/flex-layout/extended/typings/style/style.d.ts(74,39):错误TS1109:预期的表达式.node_modules/@angular/flex-layout/extended/typings/style/style.d.ts(79,5):错误TS1128:预期的声明或声明 (3认同)

Ril*_*nda 6

在项目内部:从package.json中删除/删除flex布局,然后运行:

npm update
Run Code Online (Sandbox Code Playgroud)

其次是:

npm install @angular/flex-layout@latest --save
Run Code Online (Sandbox Code Playgroud)

这将自动安装与您的角材兼容的最新版本的flex。