Reputation: 10818
I am code with vscode
using typescript
.
Everything working perfect except I do not have an autocomplete on methods in my app.ts
however if I open app.js which is automatically generated file so I can see no issues with autocomplete there.
Here is my app.ts
/// <reference path="./typings/tsd.d.ts"/>
import {Request, Response} from 'express';
var express = require('express');
var logger = require('morgan');
var cookieParser = require('cookie-parser');
var bodyParser = require('body-parser');
var app = express();
Then on typing first word I am getting autocomplete on it
But after I type .
vscode is not giving any app.
Request.
I have all td
installed.
My tsconfig.json
:
{
"compilerOptions": {
"target": "ES5",
"module": "commonjs",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": false,
"watch": true
},
"exclude": [
"node_modules"
]
}
Is there any way to fix that?
Upvotes: 2
Views: 3010
Reputation: 276191
Is there any way to fix that?
Yes. Instead of :
var express = require('express');
You should use import/require
:
import express = require('express');
https://basarat.gitbooks.io/typescript/content/docs/project/modules.html
Upvotes: 11