'Is it possible to override a type identifier from `lib.dom`?

I'm using the File System Access API in my application so I have added @types/wicg-file-system-access to make the api work with TypeScript. But in TypeScript 4.6 this api has been partially added to lib.dom, causing some of the types to clash. I have started a PR to fix these issues, but there's one problem I'm not really sure how to fix. Specifically that both lib.dom and @types/wicg-file-system-access contain the following type:

type FileSystemHandleKind = 'file' | 'directory';

And as a result I get the following error:

TS2300: Duplicate identifier 'FileSystemHandleKind'.

Normally I would just use a different name and move on, but in this case that would introduce a breaking change. Is there some sort of way to override or merge or perhaps 'undeclare' the type in lib.dom? Or am I forced to introduce a breaking change?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source