weaviate / typescript-client

Official Weaviate TypeScript Client
https://www.npmjs.com/package/weaviate-ts-client
BSD 3-Clause "New" or "Revised" License
57 stars 21 forks source link

Could not find a declaration file for module 'graphql' #106

Open j-d-carmichael opened 5 months ago

j-d-carmichael commented 5 months ago

Installed version:

"weaviate-ts-client": "^2.0.0",

Build error:

node_modules/@graphql-typed-document-node/core/typings/index.d.ts:1:35 - error TS7016: Could not find a declaration file for module 'graphql'. '...api/node_modules/graphql/index.js' implicitly has an 'any' type.
  If the 'graphql' package actually exposes this module, try adding a new declaration (.d.ts) file containing `declare module 'graphql';`

1 import type { DocumentNode } from "graphql";
                                    ~~~~~~~~~
Found 1 error in node_modules/@graphql-typed-document-node/core/typings/index.d.ts:1

The only thing i have done so far is start to create the class that will be used to connect to the weaviate database.

import weaviate, { WeaviateClient } from 'weaviate-ts-client';
import config from '@/config';

class VDBService {
  client!: WeaviateClient;

  setupClient() {
    this.client = weaviate.client({
      scheme: 'https',
      host: config.apis.weviate.host,
      headers: { 'X-OpenAI-Api-Key': config.apis.openai.apikey },
    });
  }
}

export default new VDBService();

The types npm package is deprecated: https://www.npmjs.com/package/@types/graphql

This is the dependency tree for the weaviate installation:

├─┬ weaviate-ts-client@2.0.0
│ ├─┬ graphql-request@5.2.0
│ │ ├─┬ @graphql-typed-document-node/core@3.2.0
│ │ │ └── graphql@0.11.7 deduped
│ │ ├─┬ cross-fetch@3.1.8
│ │ │ └── node-fetch@2.7.0 deduped
│ │ ├── extract-files@9.0.0
│ │ ├─┬ form-data@3.0.1
│ │ │ ├── asynckit@0.4.0 deduped
│ │ │ ├── combined-stream@1.0.8 deduped
│ │ │ └── mime-types@2.1.34 deduped
│ │ └── graphql@16.8.1
│ └── uuid@9.0.1 deduped
j-d-carmichael commented 5 months ago

This was resolved by manually installing "graphql-request": "^5.2.0",