TypeScript: Can't disable type definitions for one special library

TypeScript Version: 2.4.1

For example I want to consume a library from npm called awesome-lib. This library already ships with a TypeScript type definition but this one is outdated and buggy. The author of the library doesn’t update this one.

I’ve tried to disable that type definition completely in my own declarations.d.ts file in my project:

declare module 'awesome-lib';

Unfortunately TypeScript reads first the type definition in the library and throws some errors. So it is not possible for me to disable / hide this library for my project.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 4
  • Comments: 15 (4 by maintainers)

Most upvoted comments

for global declarations set “types” : [] this will not load any packages from @types. you can add ones you want e.g. “types”: [“node”]

@mhegazy but that’s not what I want as I said before.

Have you tried path mapping (https://www.typescriptlang.org/docs/handbook/module-resolution.html) to map that path to a non-existant one?

The best solution would be the opposite of "types" in the compiler options in the compiler options. types is exactly what I want but in the other direction: I want to exclude some type definitions.