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 missing from types.d.ts causing failed Typescript builds #46

Open
deremer opened this issue Nov 2, 2018 · 4 comments
Open

Comments

@deremer
Copy link

deremer commented Nov 2, 2018

On "typescript": "^3.0.3", when importing the library as import eventbrite from 'eventbrite';, then running tsc, an error is thrown:

node_modules/eventbrite/lib/types.d.ts:6:42 - error TS2304: Cannot find name 'RequestInit'.

6     request: (apiPath: string, options?: RequestInit) => Promise<{}>;

Expected Behavior

Should compile in Typescript

Possible Solution

Define type or interface for RequestInit.

I've added export type RequestInit = any; to the top of the types file and it complies now. Obviously any is not preferable.

Your Environment

  • SDK version: 1.0.2
  • Node version: 8.11.1
  • Operating system: Mac Mojave
@kwelch-eb
Copy link
Contributor

@deremer,

We are currently, getting that type from our compiler options being set to use dom.
https://github.com/eventbrite/eventbrite-sdk-javascript/blob/master/tsconfig.json#L3

Beyond that we are looking at the proper way to export this within our package properly.

In the mean time, you may be able to leverage that option to solve this problem.

@deremer
Copy link
Author

deremer commented Nov 12, 2018

I've confirmed that adding "dom" to the "lib" compiler option does fix the compile. Not sure if you want to keep this open or close it. For node implementations, it'd probably be preferred to not require "dom"

@kwelch-eb
Copy link
Contributor

Agreed, that was my exact thought process. Let's leave this open to until we have a proper solution for node.

Thank you for confirming!

@kwelch-eb
Copy link
Contributor

I have looked into this further and the types for isomorphic-fetch have been deprecated in favor or using lib: ['dom'].

DefinitelyTyped/DefinitelyTyped@4cb5f8c

I don't full agree with this, but that appears to be their approach to this matter.

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

2 participants