| 1 | type ObjectConstructorWithHasOwn = ObjectConstructor & { |
| 2 | hasOwn?: (value: object, property: PropertyKey) => boolean; |
| 3 | }; |
| 4 | |
| 5 | // Safari 15.3 / the matching macOS WebKit used by older Wails shells predates |
| 6 | // Object.hasOwn. react-markdown 10 calls it while validating deprecated props, |
| 7 | // so install the tiny ES2022 primitive before React imports the markdown chunk. |
| 8 | export function installObjectHasOwnPolyfill(target: ObjectConstructorWithHasOwn = Object): void { |
| 9 | if (typeof target.hasOwn === "function") return; |
| 10 | Object.defineProperty(target, "hasOwn", { |
| 11 | configurable: true, |
| 12 | writable: true, |
| 13 | value(value: object, property: PropertyKey) { |
| 14 | return Object.prototype.hasOwnProperty.call(value, property); |
| 15 | }, |
| 16 | }); |
| 17 | } |
| 18 | |
| 19 | installObjectHasOwnPolyfill(); |
| 20 |