0

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

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 Answers1

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