I have a *.d.ts files with the following content.
declare var a: SomeType;
I have not declared a type named SomeType anywhere, still, there is no error here instead typescript automatically interprets it as any. Changing the extension of the file from *.d.ts to *.ts there is an error.
Why is that? Is there something I can do so that typescript throws errors in *.d.ts files?
In my case, this was happening because I had "skipLibCheck": true in my tsconfig.json. Turning it to false fixed this problem.
This is intentional maybe this GitHub Issue will help you to better understand why that happens
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With