Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve TS errors in tests #20

Merged
merged 1 commit into from
Feb 6, 2021
Merged

Resolve TS errors in tests #20

merged 1 commit into from
Feb 6, 2021

Conversation

geoffrich
Copy link
Collaborator

This PR resolves two TS errors that were reported on build. I wasn't able to find a better solution than casting to any, though I'm not a TypeScript expert.

The first issue is that Event.returnValue is a boolean and the test asserts that it is called with a string. However, per MDN, returnValue needs to be set to a string to prevent tab close in legacy browsers:

However note that not all browsers support this method, and some instead require the event handler to implement one of two legacy methods:

  • assigning a string to the event's returnValue property

I couldn't figure out how to resolve this type conflict without potentially breaking the action for some browsers, so I cast to any.

The second issue is a mismatch between native DOM window and JSDOM window. I copied the offending lines from the main Svelte project which has a similar linting error in helpers.ts (see screenshot below). Wasn't sure how to solve this one either so I slapped an any on it for now.

image

@geoffrich geoffrich requested a review from swyxio February 6, 2021 00:29
@geoffrich geoffrich self-assigned this Feb 6, 2021
@swyxio
Copy link
Owner

swyxio commented Feb 6, 2021

me neither! any is as good a solution as any :)

@swyxio swyxio merged commit 514f303 into swyxio:main Feb 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants