0

I had a class/type called Report that's used throughout the codebase. Recently, TS started resolving Report as a built-in class: https://developer.mozilla.org/en-US/docs/Web/API/Report. Don't know if it's because of a TS update. The type for the built-in Report is in typescript/lib/lib.dom.d.ts.

I'll probably need to rename my Report to something else. However, out of curiosity, is it possible to overwrite the built-in Report type? I.e. erase the type declaration so I can declare my type.

Leo Jiang
  • 24,497
  • 49
  • 154
  • 284
  • Does this answer your question? [Overriding interface property type defined in Typescript d.ts file](https://stackoverflow.com/questions/41285211/overriding-interface-property-type-defined-in-typescript-d-ts-file) – wonderflame Jun 28 '23 at 10:26
  • I'm not sure if you can entirely remove the type, but probably you can make it empty or change it to fit your type, anyway, I wouldn't recommend doing any of these and just rename your type – wonderflame Jun 28 '23 at 10:27
  • You'd need to essentially fork that file and include your fork of it instead of the original one. So I suppose you're not using namespaces/modules in your code? If you use modules then you shouldn't have to worry about ambient global names conflicting with your stuff. – jcalz Jun 28 '23 at 12:59

0 Answers0