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

Type error in rest-api/helpers.ts #171

Open
fjcalzado opened this issue Nov 19, 2017 · 6 comments
Open

Type error in rest-api/helpers.ts #171

fjcalzado opened this issue Nov 19, 2017 · 6 comments
Assignees
Labels

Comments

@fjcalzado
Copy link
Member

fjcalzado commented Nov 19, 2017

An error is preveting the pending pull requests to pass travis integration successfully. It seems a type error in rest-api/helpers.ts. See full trace below:

ERROR in [at-loader] ./src/rest-api/helpers.ts:12:14 
    TS2322: Type '{ method: string; mode: RequestMode; credentials: RequestCredentials; headers: { 'Accept': string...' is not assignable to type 'Partial<RequestInit>'.
  Types of property 'headers' are incompatible.
    Type '{ 'Accept': string; 'Content-Type': string; }' is not assignable to type 'Headers | string[][]'.
      Type '{ 'Accept': string; 'Content-Type': string; }' is not assignable to type 'string[][]'.
        Property 'length' is missing in type '{ 'Accept': string; 'Content-Type': string; }'.
@fjcalzado fjcalzado added the bug label Nov 19, 2017
@brauliodiez
Copy link
Member

@nasdan can you take a look?

@fjcalzado
Copy link
Member Author

The weird thing is that it passes local compilation (build and also build:prod) successfully, no errors. However, typescript screams the error in VS Code:

image

Does the travis build do something different ?

@brauliodiez
Copy link
Member

I think it's an issue with typings if you wipe node_modules and reinstall it will fail.

@crsanti experienced a.similar issue in other project.

Quick work around fix versions remove the "gorrito" ;)

@fjcalzado
Copy link
Member Author

Typescript@2.6.1 seems to be the problem, travis is resolving to that version while locally targets to typescript@2.4.2. Same package.json but different versions installed 😣.

@brauliodiez
Copy link
Member

We have to upate.typescript to latest stable then try to fix

@nasdan
Copy link
Member

nasdan commented Nov 19, 2017

Yes, it's about typescript update. To solve It:

headers: new Headers({
    'Accept': 'application/json',
    'Content-Type': 'application/json',
  }),

In method base

fjcalzado added a commit to fjcalzado/LeanMood that referenced this issue Nov 19, 2017
brauliodiez added a commit that referenced this issue Nov 25, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants