feat: add support for globalThis in event handling functions#1373
Open
THernandez03 wants to merge 1 commit intotesting-library:mainfrom
Open
feat: add support for globalThis in event handling functions#1373THernandez03 wants to merge 1 commit intotesting-library:mainfrom
THernandez03 wants to merge 1 commit intotesting-library:mainfrom
Conversation
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 8132254:
|
There was a problem hiding this comment.
Pull request overview
This pull request attempts to add support for globalThis as a valid event target in the TypeScript type definitions for fireEvent and createEvent functions. The goal is to allow developers to use globalThis (which references window in browser environments) without encountering false type errors.
Changes:
- Modified type definitions in
types/events.d.tsto includeGlobalThisin union types for event handling functions - Added TypeScript type tests in
types/__tests__/type-tests.tsto validateglobalThisusage
Reviewed changes
Copilot reviewed 1 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| types/events.d.ts | Added GlobalThis to union types in FireFunction, FireObject, CreateFunction, and CreateObject interfaces |
| types/tests/type-tests.ts | Added type tests for fireEvent.click(globalThis), createEvent('customEvent', globalThis), and fireEvent(globalThis, event) |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
7152fdf to
d9f23df
Compare
d9f23df to
8132254
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What: Add
GlobalThisto the event type definitions forfireEventandcreateEvent.Why:
globalThisis a valid event target (it referenceswindowin browser environments), but the current type definitions don't accept it. This causes false type errors when firing or creating events onglobalThis.How:
GlobalThisto the union types inFireFunction,FireObject,CreateFunction, andCreateObjectintypes/events.d.ts.types/__tests__/type-tests.tsto validateglobalThisis accepted byfireEventandcreateEvent.Checklist:
docs site N/A