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

Bind fetch to window #235

Merged
merged 1 commit into from
Nov 2, 2020
Merged

Conversation

mzgoddard
Copy link
Contributor

I fixed up @rub1e's #232 solution for #230. I amended the commit so credit can go where it's due. There was an extra parentheses that created an error in the typescript compiler and the linter error was rendered on the wrong line in github.

I found the cause of the issue.

The typescript transpilation rewrites the import of the local fetch module to a commonjs require.

var fetch_1 = __importDefault(require("./fetch"));

When transpiled src/run_action.ts

    fetch(url, options)

translates to this line in lib/run_action.js

    fetch_1.default(url, options)

and so the window fetch method is called on fetch_1 as it's this.

@rub1e
Copy link
Contributor

rub1e commented Oct 28, 2020

Cheers mate - I had a reminder to come back and figure out what was going on here - you've saved me the bother!!

@benrazon benrazon self-requested a review November 2, 2020 21:25
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.

None yet

3 participants