Reputation: 82590
Is there a typescript declaration file for mongoose? I've looked at Boris Yankov's Definitely Typed repo, but there does not seem to be one. Anyone know where I can get a good d.ts file for the mongoose library?
Kind regards as always.
Upvotes: 2
Views: 2894
Reputation: 3570
This question was asked in 2013, and since then, things have changed a lot, and none of the given answer mentions how to go about finding declaration files now.
So the answer to the question, where can I find typescript declaration file for mongoose (or for any other library) is to search for such declaration file using TypeSearch
It is a tool developed by the TypeScript team that helps in searching for declaration file hosted on the DefinitelyTyped repository (which has since grown big and now almost impossible to search using the GitHub web interface).
The other thing that has changed since 2013, is that Typings
or tsd
is no longer the recommended tool for working with declaration files (as mentioned in some of the already given answers). The recommended way is to now use npm. You can read more about this here: The Future Of Declaration Files
Upvotes: 1
Reputation: 1197
Just an update on this. Now you should use typings to import your types definitions inside your application.
Use npm and install it globally:
$sudo npm install -g typings
to install the mongoose package:
$ typings install mongoose
More info about typings: https://www.npmjs.com/package/typings
Tutorial on how to setup mongoose with typings in typescript project: http://www.vandiest.biz/?p=3931
Upvotes: 2
Reputation: 251242
It is tempting to say that if it isn't on Definitely Typed it probably doesn't exist.
Of course, it was only a matter of time before it was added: Definitely Typed definition for Mongoose.
You can get all of the Definitely Typed type definitions using NuGet, or TSD (available via NPM) or just on the GitHub repository.
Upvotes: 1
Reputation: 1024
You can check http://onoffswitch.net/mongoose-with-typescript/ . It also includes a link for a github repository which contains unit tests and schema definition with typescript.
Upvotes: 1
Reputation: 82590
I found a github project here. It has the mongoose typescript definitions in there.
Upvotes: 3