Git Product home page Git Product logo

Comments (5)

mrkswrnr avatar mrkswrnr commented on September 7, 2024 1

Try adding "@nuxt/http" to types in your tsconfig.json:

{
    "compilerOptions": {
      /* ... */
      "types": [
        "@types/node",
        "@nuxt/vue-app",
        "@nuxt/http"
      ]
    }
}

from http.

Lisiadito avatar Lisiadito commented on September 7, 2024 1

This seems to be broken since the @nuxt/http bump from v0.1.2 to v0.2 since there the ky version got updated from v0.10.0 to v0.11.0.
They removed the type JSONValue sindresorhus/ky#133. So since that type is always used as the return type of for example $get $post and so on we need to adjust the index.d.ts file.

The easiest option would be to change JSONValue to unknown like they did at the ky repo or just use the old definition of JSONValue from the ky repo.
I would make a PR for that if @pi0 agrees.

from http.

itsfarseen avatar itsfarseen commented on September 7, 2024

That didn't work :(

from http.

itsfarseen avatar itsfarseen commented on September 7, 2024

This is the error:

 ERROR  ERROR in nuxt-http-typescript-bug1-repro/node_modules/@nuxt/http/types/index.d.ts                                                                                                                 19:03:18
2:85 Module '"../../../ky"' has no exported member 'JSONValue'.
    1 | import Vue from 'vue'
  > 2 | import { ResponsePromise, Options, BeforeRequestHook, AfterResponseHook, HTTPError, JSONValue } from 'ky'
      |                                                                                     ^
    3 | import './vuex'
    4 | 
    5 | type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;

Interestingly, the error says nuxt-http-typescript-bug1-repro/node_modules/@nuxt/http/types/index.d.ts even when I don't have "@nuxt/http" in tsconfig.json.

from http.

mrkswrnr avatar mrkswrnr commented on September 7, 2024

Seems like there is something missing in the definition. As a workaround you can try placing this in an ambient declaration file (anyname.d.ts):

declare module "ky" {
  interface JSONValue extends Object {}
}

from http.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.