Skip to content

Typescript definitions are outdated #467

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mnasyrov opened this issue Aug 26, 2016 · 19 comments
Closed

Typescript definitions are outdated #467

mnasyrov opened this issue Aug 26, 2016 · 19 comments

Comments

@mnasyrov
Copy link

For example, now Collection.prototype.find(query) returns an array while it is defined as LokiCollection.find(query: LokiQuery): LokiResultset<E> in the typescript definitions.

@obeliskos
Copy link
Collaborator

Your right, collection find should return object[] or null. It should be just collection.chain() that returns a (Loki) 'Resultset'.

@TeamworkGuy2 kindly provided those definitions. I've not yet had time to research this enough to be familiar with the syntax to fix any issues with them.

If you are able to, it would be nice if you could help update those as our v1.4.x (main) branch is stable (maybe a few non-breaking extra constructor options we may want to add). Otherwise I will add this to my todo list for when I (or anyone interested in updating these) can get around it.

@TeamworkGuy2
Copy link
Contributor

If I ever have spare time I'll update it. But it's a 6+ hour process for me to extract accurate definitions from a library of loki.js' size and it's a very boring task :)

@obeliskos
Copy link
Collaborator

Great... while my request was meant for @mnasyrov, if you ever get some time, it would be appreciated :)

Would be nice if there was a way to leverage jsdoc/closure annotations to scaffold some definitions.

@mnasyrov
Copy link
Author

Sorry guys, have no time right now.

@mnasyrov
Copy link
Author

There are definition file generators from js like dtsmake, but they also require manual work to define type structures.

@RobertoMalatesta
Copy link

Moving the whole of the project to TypeScript could be an option, since that could favor reading the code and submitting patches/issues/contributions.

--R

@foxel
Copy link
Contributor

foxel commented Jun 2, 2017

Any update on this?

@thasmo
Copy link

thasmo commented Nov 24, 2017

This project look pretty awesome, too bad there are no up-to-date TypeScript typings available. Just wanted to add my +1 for conversion to TypeScript or maintaining official typings.

@TeamworkGuy2
Copy link
Contributor

I found some time to update the definition; I'll hopefully be finished by the end of the weekend.

@Viatorus
Copy link
Collaborator

@thasmo

Have a look at https://github.com/LokiJS-Forge/LokiJS2 - a official successor, converted to Typescript (but still beta).

@thasmo
Copy link

thasmo commented Nov 25, 2017

@Viatorus Thanks! Tried it but it seems the npm package doesn't include typing or do I miss something?

@Viatorus
Copy link
Collaborator

Viatorus commented Nov 25, 2017 via email

@TeamworkGuy2
Copy link
Contributor

Latest lokijs 1.5.1 definition just got merged to definitely typed (pull: DefinitelyTyped/DefinitelyTyped#21747, commit: DefinitelyTyped/DefinitelyTyped@766089f).
Should auto update to npm in a day or two.

@Viatorus Viatorus closed this as completed Dec 4, 2017
@foxel
Copy link
Contributor

foxel commented Dec 5, 2017

I can't get how do I use LokiIndexedAdapter with typings now. :(

@TeamworkGuy2
Copy link
Contributor

@foxel I'm not sure how LokiIndexedAdapter works, I've never used it. I probably won't have time to analyze the code and write a definition in the near future. :/
If you're familiar with LokiIndexedAdapter, please help write one up and send a pull request to DefinitelyTyped!
Also take a look at these definitions inside lokijs, maybe they're related to what you're looking for:

@CanisHelix
Copy link

@TeamworkGuy2 Will the typescript definitions for 1.5.2 work for loki 1.5.5 or are their too many changes?

@TeamworkGuy2
Copy link
Contributor

@Shiroikuma A quick diff of the src/lokijs.js files from releases version 1.5.2 zip to 1.5.5 zip shows there's several changes to method signatures and enumerations, for example LokiOps has some new values and Resultset.prototype.simplesort 2nd parameter changed from a boolean to an options object (although it looks like you can still pass a boolean for backward compatibility).
Answer: I'm not sure, I don't work on LokiJS, I just wrote a one time definition for it which I updated once or twice.

@obeliskos
Copy link
Collaborator

I did update our typescript definitions but apparently i missed a versioning number somewhere because when i run :

npm i @types/lokijs

it will report version 1.5.2, however the definitions are actually 1.5.3 which are latest.

@TeamworkGuy2 : any idea why that might be?

@TeamworkGuy2
Copy link
Contributor

TeamworkGuy2 commented Jul 21, 2018

@obeliskos I'm not sure why it's wrong, version numbers of npm @types packages are controlled by the version string in the definitely typed definition file (for lokijs see https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lokijs/index.d.ts)
You're right though, NPM https://www.npmjs.com/package/@types/lokijs lists the version as 1.5.2.
I'd report it as an issue to the DefinitelyTyped repository, although that repository has over 2000 open issues and the Microsoft team doesn't curate it much.

If you have time to dig in to it yourself, you could look at the types-publisher tool the definitely typed team use for publishing the packages: https://github.com/Microsoft/types-publisher

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants