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

checkjs doesn't allow type annotations with types from required modules #18460

Closed
akdor1154 opened this issue Sep 14, 2017 · 2 comments
Closed
Labels
Duplicate An existing issue was already created

Comments

@akdor1154
Copy link

akdor1154 commented Sep 14, 2017

TypeScript Version: 2..5.2

Code

npm install --save-dev typescript @types/express
npm install --save express

tsconfig.json

{
  "compilerOptions": {
    "module": "commonjs",
    "allowJs": true, 
    "checkJs": true,
    "strict": true  
  }
}

test.js

const localExpressName = require('express');
/**
 * @type {localExpressName.Application}
 */
let app;

Expected behavior:
app is typed as an express Application.

Actual behavior:

error TS2503: Cannot find namespace 'localExpressName'.

app is hence typed as any.

@DanielRosenwasser DanielRosenwasser changed the title checkjs doesn't allow type assertions with types from required modules checkjs doesn't allow type annotations with types from required modules Sep 14, 2017
@DanielRosenwasser
Copy link
Member

Looks like a duplicate of #16489.

@DanielRosenwasser DanielRosenwasser added the Duplicate An existing issue was already created label Sep 14, 2017
@akdor1154
Copy link
Author

does indeed, sorry.

@microsoft microsoft locked and limited conversation to collaborators Jun 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

2 participants