Issue 1:
Move Destructor into the React namespace so my typescript can use it.

React version: 17.0.2

Steps To Reproduce

I want to create functional hook components that replace commonly duplicated code - for instance, I am commonly using my event bus.

// somewhere...
const AppContext = createContext<{ eventbus: EventEmitter }>({ eventbus: new EventEmitter() })
// elsewhere...
const { eventBus } = useContext(AppContext)
useEffect(() => {
if (!eventBus) return
if (!otherThing) return
if (someStateThing) eventBus.emit("setup", otherThing.bit(someStateThing))
return (): void => void eventBus.emit("cleanup", otherThing.bit(someStateThing))
}, [ eventBus, otherThing, someStateThing ] )

But I want to compose something I can use like this:

useEffectWithEventBus((eventBus) => {
if (!otherThing) return
eventBus.emit(otherThing.bit(someStateThing))
(): void => void eventBus.emit("cleanup", otherThing.bit(someStateThing))
}, [otherThing, someStateThing])

But when I go to try and define that

const useEffectWithEventBus: (cb: (eventbus: EventEmitter) => void | Destructor, deps: DependencyList) => void = (cb, deps) => {
const { eventBus } = useContext(AppContext)
useEffect(() => cb(eventBus), [ eventBus, ...deps ])
}

Cannot find name Destructor

But EffectCallback IS () => void | Destructor

And destructor is type Destructor = () => void | { [UNDEFINED_VOID_ONLY]: never };

Its not inside the React Namespace - Destructor is mysteriously limited to the File scope of the react index? So I can't define my custom hook to have a function that can return a destructor... because I don't have access to the Destructor type.

I thought, well, maybe I can just do functional composition on that... but... how do I define my callback out of the scope where eventBus is pulled from the context? I might be able to get it in there functionally by using the .call(this) context...

const useEffectWithEventBus: (cb: EffectCallback, deps: DependencyList) => void = (cb, deps) => {
const { eventBus } = useContext(AppContext)
useEffect(() => cb.call(eventBus), [ eventBus, ...deps ])
}
useEffectWithEventBus(() => {
if (!otherThing) return
this?.emit(otherThing.bit(someStateThing))
(): void => void this?.emit("cleanup", otherThing.bit(someStateThing))
}, [otherThing, someStateThing])

But then the compiler thinks that this might be undefined (true) and it has no idea that this refers to an EventEmitter - and it eludes me how(or even if is possible) to type narrow this to an EventEmitter. (that's pretty advanced typing don't you think?)

The current behavior

Destructor type not exported enough to use in my code

The expected behavior

Destructor type is exported enough to use in my code

Issue 2:
Describe what you were doing when the bug occurred:

1.

2.

3.

Please do not remove the text below this line

DevTools version: 4.11.0-39713716aa

Call stack: at store_Store.getElementAtIndex (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/main.js:22171:35)

at store_Store.getElementIDAtIndex (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/main.js:22187:26)

at chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/main.js:29770:63

at List.render (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/main.js:23893:18)

at Ii (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/main.js:14002:76)

at Hi (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/main.js:13993:10)

at uk (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/main.js:16728:86)

at tk (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/main.js:16245:11)

at qk (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/main.js:16237:23)

at jk (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/main.js:16221:5)

Component stack: at List (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/main.js:23588:30)

at div

at AutoSizer (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/main.js:3111:5)

at div

at div

at Tree_Tree (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/main.js:29531:47)

at div

at div

at OwnersListContextController (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/main.js:28680:3)

at SettingsModalContextController (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/main.js:29121:3)

at Components_Components (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/main.js:34645:52)

at ErrorBoundary_ErrorBoundary (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/main.js:30035:5)

at PortaledContent (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/main.js:30157:5)

at div

at div

at ProfilerContextController (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/main.js:34264:3)

at TreeContextController (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/main.js:25356:3)

at SettingsContextController (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/main.js:25963:3)

at ModalDialogContextController (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/main.js:30300:3)

at DevTools_DevTools (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/main.js:37639:3)