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
Asked
Active
Viewed 769 times
0

Nazar Kalytiuk
- 1,499
- 1
- 11
- 21
-
https://stackoverflow.com/questions/35647862/exclude-subdirectories-in-tsconfig-json – SJxD Feb 03 '22 at 20:18
1 Answers
0
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);
}

jsejcksn
- 27,667
- 4
- 38
- 62
-
@ts-ignore in b.ts looks like a good idea, but it didn't help. It works only in a.ts. But I can't change a.ts. – Nazar Kalytiuk Feb 04 '22 at 08:26