'How to exclude folder from typescript check, but still compile
I want to build libs/libb with libs/libb/tsconfig.json. In this tsconfig I have an option "noImplicitAny": true. But file in libb imports file from liba. This file contains a function with arguments with any type. So I can't build libb. How to exclude liba folder from check, but still compile it if liba imports it? Here is a minimal reproducible example https://github.com/NazarKalytiuk/typescript-kcf5m9
Solution 1:[1]
You can explicitly annotate the parameters as any:
a.ts:
// before
export function testA(a, b) {
console.log('Hello')
}
// after
export function testA(a: any, b: any) {
console.log('Hello')
}
And if you can't modify the source TypeScript file that you're importing, you can use a // @ts-ignore comment directive before the line that's causing the problem:
b.ts:
// @ts-ignore
import {testA} from "../liba/a"
function testB(a: number, b: number) {
console.log('Hello')
testA(1,2);
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | jsejcksn |
