我正在研究SPFX(SharePoint Framework)React应用程序。
在安装流行的AutomApper( @automapper/core @automapper/pojos)之后,我在 Gulp Build build
:
我的tsconfig.json看起来如下:
我正在使用Rush-Stack-Compiler 4.2,该4.2使用Typescript 4.2.4幕后。
我根据其他问题的答案尝试的事情:
- 升级打字稿版本 - 在SPFX中,这是通过将Rush-Stack-Compiler升级到4.2来完成的
这只会有所帮助,因为@AutomApper库中的类型错误较少,但并非所有这些错误都是固定的。
- 添加
“ dublude”:[“ node_modules”]
添加到tsconfig.json
- add
“ skiplibcheck”:true
to tsconfig.json
- 指定的空
“ empter” “ ]
在tsconfig.json中设置,
为什么TSC专门查看node_modules/@autoMapper文件夹,尽管Node_modules中有数百个带有 *.D.TS文件的其他文件夹,而不是问题?
I am working on an SPFX (SharePoint Framework) React application.
After installing the popular automapper for typescript (@automapper/core @automapper/pojos) I keep getting compiler errors during gulp build
:

My tsConfig.json looks like the following:

I am using rush-stack-compiler 4.2 which is using typescript 4.2.4 behind the scenes.
Things I have tried based on the answers from other questions:
- Upgrade typescript version - in SPFX this is done by upgrading the rush-stack-compiler from 3.7 to 4.2
This helped only a little, as there are LESS type errors from the @automapper library, but not all of them were fixed.
- Add
"exclude": [ "node_modules" ]
to the tsConfig.json
- Add
"skipLibCheck": true
to the tsConfig.json
- Specified empty
"types": []
setting in tsConfig.json
Any idea why tsc is looking specifically into the node_modules/@automapper folder, although there are hundreds of other folders in node_modules with the *.d.ts files, that are not a problem?
发布评论
评论(1)
尝试将打字稿更新为4.5:
@Microsoft/Rush-stack-Compiler-4.5
看起来@Automatpper正在使用Bleeding-Edge-Edgecript标题功能。该问题与
node_modules
的包含/排除无关,它似乎与打字稿版本有关(您似乎已经安装了一个较旧的版本,该版本不了解自动应用程序的某些定义)。或者,使用旧版本的汽车应用程序(7.x可能还可以)
Try updating typescript to 4.5:
@microsoft/rush-stack-compiler-4.5
It looks like the @automatpper is using bleeding-edge typescript features. The problem is not related to inclusion/exclusion of the
node_modules
, it seems to be related to the typescript version (you seem to have installed an older version that does not understand some definitions of the automapper).Alternatively, use an older version of the automapper (7.x should probably be okay)