Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
? (...args: R) => Ret
: never;

const DOCUMENT = typeof document !== "undefined" ? document : undefined;
// const DOCUMENT = typeof document !== "undefined" ? document : undefined;

/**
* Creates a custom event with an associated React hook for listening.
Expand All @@ -27,7 +27,7 @@
* @param {EventInit} [eventInitDict] - Additional options for the event.
*/
function dispatch(payload: Payload, eventInitDict?: EventInit) {
DOCUMENT?.dispatchEvent(

Check failure on line 30 in src/index.ts

View workflow job for this annotation

GitHub Actions / 🧪 Test

src/index.test.ts > createCustomEvent > should create a custom event and allow dispatching it

ReferenceError: DOCUMENT is not defined ❯ Function.dispatch src/index.ts:30:5 ❯ src/index.test.ts:25:22 ❯ Proxy.act node_modules/react/cjs/react.development.js:2512:16 ❯ src/index.test.ts:24:5
new CustomEvent<Payload>(eventName, {
...eventInitDict,
detail: payload,
Expand Down
Loading