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

RequestInit type not available in non-DOM (pure-Node) environment #151

Open
threema-danilo opened this issue Jan 27, 2023 · 1 comment
Open

Comments

@threema-danilo
Copy link

I'm using emojibase-data to generate an emoji picker. This script runs in a NodeJS environment, so the DOM types aren't available.

SInce #139, emojibase-data includes types that extend RequestInit. This type is not available in a non-DOM context:

../../node_modules/emojibase/dts/types.d.ts:106:46 - error TS2304: Cannot find name 'RequestInit'.

106 export interface FetchFromCDNOptions extends RequestInit {
                                                 ~~~~~~~~~~~

In TypeScript, this type is defined in lib/lib.dom.d.ts and lib/lib.webworker.d.ts.

Maybe the package could be restructured somehow, so that these CDN fetching types are only included when importing the full emojibase package, but not when importing only emojibase-data?

@threema-danilo
Copy link
Author

When not using CDN, this can be worked around with the following definition in the project:

declare global {
    export interface RequestInit {}
}

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

No branches or pull requests

1 participant