Comments (3)
While implementing this, I've found a few issues with passing fetch options, so I'm implementing a different solution now:
- The internal types don't depend on the dom lib, the
@types/web
package or anything else anymore. Instead, the smallest common denominator was extracted into and exported from the@d-fischer/cross-fetch
package. - If you need to pass fetch options that are specific to one platform, you can now augment the
TwitchApiCallFetchOptions
type (this is possible because it was changed to an interface) - This is a breaking change for all current users of the
fetchOptions
config option (but I'm pretty sure your approach would be too in some obscure way), so it will only be implemented in version 7.0.
Stay tuned for a new prerelease version within the next week.
from twurple.
As the types used are inherently global, do you have a better solution for this?
from twurple.
@d-fischer Sure! One way we can accomplish this would be to use and import the @types/web
package as a replacement for the triple slash lib directive to acquire the DOM types.
I've already tested this out with Twurple and it works perfectly! It no longer overrides the types globally. You can checkout how my reproduction is no longer showing any compile errors here. Just clone and switch branches with git checkout fix/using-@types/web
.
To add the package, we just run the following:
cd packages/api-call
# it's fine to add this as a devDependency
yarn add @typescript/lib-dom@npm:@types/web --dev
We then remove the directive /// <reference lib="dom" />
from both packages/api-call/src/apiCall.ts
and packages/api-call/src/TwitchApiCallOptions.ts
.
Finally, we just need to import the following at the top of the file (we only need to import it once):
// packages/api-call/src/TwitchApiCallOptions.ts
import '@typescript/lib-dom';
from twurple.
Related Issues (20)
- Returning Chatter tag
- Update EventSub WS endpoint URL
- ElectronAuthProvider receives Unsupported Browser error when logging into Twitch HOT 1
- ```HelixStreamApi#getFollowedStreams``` and ```HelixStreamApi#getFollowedStreamsPaginated``` always raise an exception HOT 1
- eventsub-ws reconnect is triggering onUserSocketDisconnect HOT 1
- Electron Authenticate Issue HOT 1
- Hype Train Pubsub event HOT 2
- Make `ebs-helper` compatible across different runtimes using `jose` instead of `jsonwebtoken` HOT 1
- Eventsub flatmap error HOT 3
- Get Custom Reward API calls fail with a token with only `channel:manage:redemptions`
- Allow PubSubClient to accept AppTokenAuthProvider HOT 3
- EventSubMiddleware not working with Express Router HOT 4
- DropEntitlementGrant uses incorrect CLI name
- `EventSubWsListener#onStreamOnline` with `RefreshingAuthProvider` raises an access token error HOT 1
- Method signature issue for `onUserModeration`
- "object null is not iterable" when accessing EventSubChannelSubscriptionMessageEvent.emoteOffsets
- HelixHypeTrainEvent: id and eventId are identical
- "This should never happen" HOT 5
- How do I get emote URLs from a chat message in v7? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from twurple.