Skip to content
This repository has been archived by the owner on Feb 7, 2023. It is now read-only.

Update README.md #16

Merged
merged 1 commit into from
Apr 13, 2020
Merged

Update README.md #16

merged 1 commit into from
Apr 13, 2020

Conversation

leo-ar
Copy link
Contributor

@leo-ar leo-ar commented Apr 13, 2020

  • Recommend libraries to include in users' project configuration.
  • Update links to the new typescript docs.

[`tsconfig.json`]: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html
[`Request`]: https://developers.cloudflare.com/workers/reference/apis/request/
[`Response`]: https://developers.cloudflare.com/workers/reference/apis/response/
[`Headers`]: https://developer.mozilla.org/en-US/docs/Web/API/Headers
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is cool. I didn't know you could do this.

@jrf0110
Copy link
Member

jrf0110 commented Apr 13, 2020

Thanks again @leo-ar !

@jrf0110 jrf0110 merged commit 5163f0e into cloudflare:master Apr 13, 2020
@leo-ar leo-ar deleted the expand-readme branch April 13, 2020 16:45
@ispivey
Copy link
Contributor

ispivey commented May 15, 2020

@leo-ar does including all of these libraries at the same time work for you? I ran into type definition conflicts when doing this, described in #25

@leo-ar
Copy link
Contributor Author

leo-ar commented May 15, 2020

@ispivey our tsconfig.json has

    "target": "ES6",
    "moduleResolution": "node",
    "allowSyntheticDefaultImports": true,
    "allowJs": true,
    "jsx": "react",
    "checkJs": true,
    "strict": true,
    "lib": ["DOM", "DOM.Iterable", "ES2018", "WebWorker"],

and it is type-checking correctly with "typescript": "^3.9.2". Seeing the same errors.
Since this worked and it is what our project needs I didn't try any other variations.

If you end up finding what the issue was, even if it was miss-configuration, consider adding it to the README.

@ispivey
Copy link
Contributor

ispivey commented May 15, 2020

That's strange. Using your exact config, and "@cloudflare/workers-types": "^1.0.9", and a nearly-trivial Worker script like the below, I get 39 errors caused by conflicts between lib.webworker.d.ts and lib.dom.d.ts upon transpilation.

addEventListener('fetch', event => {
  event.respondWith(fetch('https://httpbin.org/get'))
})

export {}

We made some changes in #25 to address this, but I'd love to file a follow-up and figure out why that's working in your project, but not others.

@leo-ar
Copy link
Contributor Author

leo-ar commented May 15, 2020

@ispivey I was incorrect. I am seeing the errors you describe with our configuration too.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants