GithubHelp home page GithubHelp logo

Comments (5)

alexserov avatar alexserov commented on May 26, 2024

You encountered this issue because the Typescript compiler couldn't find the expected constructor overload. You can examine available constructors by going to the DataSource declaration. You can find it by calling the Go To Definition command (usually, it is bound to the F12 key) or by opening the node_modules/devextreme/data/data_source.d.ts file.

In your case, the basic DataSource initialization code may look as follows:

new DataSource({
  load: (loadOptions) => {
    return new Promise((r) => r([1,2,3]));
  },
  byKey: (key) => {
    return new Promise((r)=>r(1));
  }
})

from devextreme-angular.

slubowsky avatar slubowsky commented on May 26, 2024

Problem is that the real code already does return a promise, and works as expected in 21.2.3. Ill take another look though..

from devextreme-angular.

alexserov avatar alexserov commented on May 26, 2024

@slubowsky Could you provide a sample app or an actual code snippet from your application? It will help us investigate the problem.

from devextreme-angular.

slubowsky avatar slubowsky commented on May 26, 2024

@alexserov Maybe something like this? compiles in 21.2.3 - but not 21.2.4

this.dataSource = new DataSource({
      load: _loadOptions => {
        return lastValueFrom(this.httpClient.post('https://somewhere', {}))
          .then((result: any) => {
            return {
              data: result
            };
          }).catch(e => {
            console.error(e);
          });
      }
    });

from devextreme-angular.

slubowsky avatar slubowsky commented on May 26, 2024

@alexserov looks like removing the catch solves the problem...

from devextreme-angular.

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.