question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

typescript support so that we get type completion from objects returned in `find`

See original GitHub issue

Problem

  1. I want to ensure type completion on objects returned in find
  2. I want to make sure the correct type of doc is passed in an insert

Context

I looked at the type definition file for nedb in DefinitelyTyped (https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/nedb/index.d.ts)

I see passing of type T in a few places there. I was unsure where to pass types during instantiation because new object creation of nedb doesn’t take in type information.

Please let me know if I can use types with nedb or pass in type information into nedb to get some type goodness.

If nedb doesn’t support types, I’m sure I can just create a wrapper class for this, so no worries. Also, thanks for making such a neat library 😃

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8

github_iconTop GitHub Comments

1reaction
marcusjwhelancommented, May 12, 2017

@dheerajbhaskar Myself and another developer are currently working on a TypeScript replacement. I just finished the AVL Btree for it last week. It is still in development. teDB the db, and binary-type-tree the btree

0reactions
dheerajbhaskarcommented, May 12, 2017

That I understand about indices, but I’m unable to see how that’s relevant from the types and autocomplete perspective.

Typescript does allow that, it’s called type assertion, see http://stackoverflow.com/a/35362350/1311745

I’ll contribute back here or as another package if I end up implementing this.

Thanks for taking the time all 🙂👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

Documentation - Advanced Types - TypeScript
This page lists some of the more advanced ways in which you can model types, it works in tandem with the Utility Types...
Read more >
How can I see the full expanded contract of a Typescript type?
Here is a type alias I sometimes use to try to expand a type in the way you're talking about: // expands object...
Read more >
Announcing TypeScript 4.9 - Microsoft Developer Blogs
Today we are excited to announce the availability of TypeScript 4.9! If you're not familiar with TypeScript, it's a language that builds on ......
Read more >
TypeScript Types Explained – A Mental Model to Help You ...
"Hm, it is a list of integers, so I'll need to filter only the even numbers and return a new list"; "This is...
Read more >
typescript-cheatsheet - GitHub Pages
In TypeScript, we support much the same types as you would expect in ... In JavaScript, so as in TypeScript, Objects are comprised...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found