Reputation: 21037
I'm trying to migrate more of my backend code to Typescript as I love having type checking, and the marketing always suggests you can do as much or as little as you like in typescript. But it remains really hard to set it up, even in VS Code which is supposed to make it easy.
Here is a new module I am creating. The reference path is correct, but nothing after that is working. I can't for example, use the Model
interface; import .. = require
can't find the .js
file; the mongoose
name space is not available for my interface definition;...
What should I do to make some progress?
///<reference path="../../../typings/mongoose/mongoose.d.ts" />
// var Resto : Model = require('./resto.model');
import Resto = require('./resto.model'); // a .js file
interface IResto extends mongoose.Document {
"qname" : string;
"rname" : string;
"similar" : string[];
}
Resto.find({})
Upvotes: 1
Views: 627
Reputation: 276303
import .. = require can't find the .js file;
import
will only find the ts
file. Change the extension to .ts
More tips : https://basarat.gitbooks.io/typescript/content/docs/types/migrating.html
Upvotes: 1