neode icon indicating copy to clipboard operation
neode copied to clipboard

Does Neode.create<T>(...) async?

Open kingpeti opened this issue 3 years ago • 8 comments

when using this method it is not working as defined in TS. But when I use async-await everything is fine and the return value from Neode.create<T>(...) is present. To work as expected I think it needs to wrap in promise.

Neode.create<T>(model: string, properties: object): Promise<Neode.Node<T>>;

Am I Correct?

kingpeti avatar Sep 26 '21 15:09 kingpeti

Yes

Aqua-4 avatar Feb 23 '22 11:02 Aqua-4

It's in the source: https://github.com/adam-cowley/neode/blob/master/types/index.d.ts#L84, but for some reason when I npm install neode@latest, the line is

create<T>(model: string, properties: object): Neode.Node<T>;

@adam-cowley do you have any ideas? Thanks!

LucaProvencal avatar Mar 05 '22 17:03 LucaProvencal

The create service does return a Promise so I get the feeling that neode@latest might not actually be the latest. Could you try version 0.4.7?

adam-cowley avatar Mar 07 '22 10:03 adam-cowley

Thanks for the reply. That's the version it installed. The same thing happens with npm install [email protected].

LucaProvencal avatar Mar 07 '22 14:03 LucaProvencal

I have just tried on codesandbox and it seems fine to me. Is it just the code hinting/intellisense that is out of date or is the code failing?

https://codesandbox.io/s/bold-blackburn-5088nm?file=/index.js

adam-cowley avatar Mar 07 '22 14:03 adam-cowley

The code works fine without TypeScript. TypeScript compiler throws an error when it shouldn't since the line should be

Neode.create<T>(model: string, properties: object): Promise<Neode.Node<T>>;

instead of

Neode.create<T>(model: string, properties: object): Neode.Node<T>;.

I think it is some problem with the 0.4.7 distribution on NPM. The code doesn't match what is in the repo.

LucaProvencal avatar Mar 07 '22 14:03 LucaProvencal

I have just bumped the version number and republished, so hopefully version 0.4.8 will fix the problem.

adam-cowley avatar Mar 08 '22 10:03 adam-cowley

@adam-cowley That worked! Thanks. Don't want to speak for @kingpeti but I think we can close this

LucaProvencal avatar Mar 08 '22 13:03 LucaProvencal