Why Nostr? What is Njump?
2024-03-19 06:53:14

Dusty Pomerleau on Nostr: TypeScript’s `document.activeElement` returns `Element`. If the `Element` is an ...

TypeScript’s `document.activeElement` returns `Element`. If the `Element` is an `HTMLElement` you have to cast it back every time you use a method not available on `Element` (or ignore/expect the error TS gives when you call `activeElement()`).

In Rust, we would fix this by returning `impl Element`. Is there any equivalent in TS?

#TypeScript #RustLang
Author Public Key
npub1t007tscc3gj0wmhaxajgjvxc4k37gkykr5pm9cxkyktdfamwgauqjg5tp0