angular的踩坑之路

vscode中export class报错

在这里插入图片描述
版本号: ~10.0.6 & ~11.0.1

问题描述: Experimental support for decorators is a feature that is subject to change in a future release. Set the ‘experimentalDecorators’ option in your ‘tsconfig’ or ‘jsconfig’ to remove this warning.(对装饰器的实验支持是一项功能,将来的版本中可能会对其进行更改。 在“ tsconfig”或“ jsconfig”中设置“ experimentalDecorators”选项以删除此警告。)

原因:
1、vscode没有识别到根目录下的tsconfig或jsconfig中的experimentalDecorators为true;
2、也没有设置javascript.implicitProjectConfig.experimentalDecorators为true。

解决方案:
1、需要在tsconfig或jsconfig设置experimentalDecorators为true;
2、或者在VSCode的settings.json中设置javascript.implicitProjectConfig.experimentalDecorators为true。

注意: tsconfig.json文件必须在项目根目录下,不可更改tsconfig.json文件名!也不可更改存放文件路径!即使angular.json指定了其他相对应的文件名也不可!

vscode中配置了angular.json中指定的tsConfig的compilerOptions的paths属性,路径对了,但vscod仍报错

在这里插入图片描述在这里插入图片描述
版本号: ~10.0.6 & ~11.0.1

问题描述: Cannot find module ‘@router/app.router’ or its corresponding type declarations.

解决方案: 和vscode中export class报错的原因一样,请参考上一个问题的解决方案。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值