Hur man ignorerar TypeScript-fel i importerad modul
Mitt projektbygge fastnar på ett TypeScript-fel som är internt i ett importerat modul. Hur berättar jag för TypeScript att ignorera det?
Uppenbarligen vill jag att TypeScript ska hjälpa mig med min egen kod, inte straffa mig för typefel i en tredjepartsimport.
I min tsconfig.json har jag
{
"compilerOptions": {
"skipLibCheck": true,
...
},
"exclude": ["node_modules"],
...
}
Men jag får fortfarande
./node_modules/@[vendor]/[module]/src/components/ChatWidget.tsx:63:58
Type error: Type 'StaticImageData' is not assignable to type 'string'.
61 | <MessageCount count={props.unreadCount || unreadCount} isOpen={isOpen} />
62 | {isOpen ? (
> 63 | <img className={'rschat-launcher__icon--open'} src={launcherIconActive} alt={'open chat window'} />
| ^
64 | ) : (
65 | <img className={'rschat-launcher__icon--closed'} src={launcherIcon} alt={'close chat window'} />
66 | )}
Projektet är Next.js. Storybook bygger med den här modulen utan klagomål.