Skip to content
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

Include @types from typings #15922

Closed
sant123 opened this issue Nov 22, 2016 · 4 comments
Closed

Include @types from typings #15922

sant123 opened this issue Nov 22, 2016 · 4 comments
Assignees
Labels
javascript JavaScript support issues typescript Typescript support issues upstream Issue identified as 'upstream' component related (exists outside of VS Code)

Comments

@sant123
Copy link

sant123 commented Nov 22, 2016

  • VSCode Version: 1.7.2
  • OS Version: Windows 8.1

Steps to Reproduce:

  1. Download oracledb npm i oracledb
  2. Init a package.json
  3. Asign a type with jsdoc into a var
/** @type { IConnectionAttributes } */
var config = require("./config");

You can notice there's no intellisense with this interface from oracledb typings.

image

interface IConnectionAttributes {
    user?: string;
    password?: string;
    connectString: string;
    stmtCacheSize?: number;
    externalAuth?: boolean;
    /** If not passed, "default" will be used. */
    poolAlias?: string;
}
@mjbvz mjbvz added the typescript Typescript support issues label Nov 22, 2016
@mjbvz
Copy link
Collaborator

mjbvz commented Nov 23, 2016

Thanks for the report. Do you notice this problem with any other packages (oracledb is a pain to install and seems to require me registering with oracle in order to get the "Oracle Instant Client")

nov-22-2016 16-01-59

Also, do you import IConnectionAttributes? TypeScript will not pick up the types unless you do this. Here's what I did for express:

import express from 'express'

/**
 * @type {express.Application}
 */
var app;

@mjbvz mjbvz self-assigned this Nov 23, 2016
@sant123
Copy link
Author

sant123 commented Nov 23, 2016

@mjbvz thanks to you for answering. 😄 Sure, I've tested with express and it works as expected according with your example, however it only works with ES2015 import/export feature, but not with Common.js. Running this code will raise an exception.

Here I show you the behavior with Common.js against ES2015.

ata example

@mjbvz mjbvz added javascript JavaScript support issues upstream Issue identified as 'upstream' component related (exists outside of VS Code) labels Apr 4, 2017
@mjbvz
Copy link
Collaborator

mjbvz commented Apr 4, 2017

After looking at this again, this looks like a duplicate of microsoft/TypeScript#11825 or microsoft/TypeScript#14056 We're tracking these on the TypeScript side.

As you noted, the workaround currently is to use an import pattern instead of var x = require(...)

@mjbvz mjbvz closed this as completed Apr 4, 2017
@MicahZoltu
Copy link

Unfortunately, using the import pattern only works if you are writing (or transpiling from) ES2015. I have been unable to find a workaround that works with ES5.

@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 18, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
javascript JavaScript support issues typescript Typescript support issues upstream Issue identified as 'upstream' component related (exists outside of VS Code)
Projects
None yet
Development

No branches or pull requests

3 participants