neode
neode copied to clipboard
Does Neode.create<T>(...) async?
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?
Yes
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!
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?
Thanks for the reply. That's the version it installed. The same thing happens with npm install [email protected]
.
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
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.
I have just bumped the version number and republished, so hopefully version 0.4.8
will fix the problem.
@adam-cowley That worked! Thanks. Don't want to speak for @kingpeti but I think we can close this