Skip to content

Type definition of withProperties should be any, not any[]? #15

@erikvullings

Description

@erikvullings

I've been using the javascript weaviate-client and just switched to this one. The migration was painless, and I only needed to make minor changes. One of them, however, surprised me. According to the JS documentation, withProperties requires an object (called schema in the example code from the website shown at the bottom). However, the TS documentation states it is a any[]. I prefer if it would be using generics, but shouldn't it be just any?

TypeScript type definition in updater.d.ts:

withProperties: (properties: any[]) => this;

JavaScript example from the website:

const weaviate = require('weaviate-client');

const client = weaviate.client({
  scheme: 'http',
  host: 'localhost:8080',
});

var className = 'Author';
var id = '36ddd591-2dee-4e7e-a3cc-eb86d30a4303';

client.data
    .getterById()
    .withClassName(className)
    .withId(id)
    .do()
    .then(res => {
        // alter the schema
        const schema = res.schema;
        schema.name = 'J. Kantor';
        return client.data
            .updater()
            .withId(id)
            .withClassName(thingClassName)
            .withProperties(schema)
            .withConsistencyLevel(weaviate.replication.ConsistencyLevel.ALL)  // default QUORUM
            .do();
        })
    .then(res => {
        console.log(res)
    })
    .catch(err => {
        console.error(err)
    });

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions