Skip to content

[ts] Could not find a declaration file for module in .js file (importing Vue ESM version) #24749

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

Closed
David-Else opened this issue Jun 7, 2018 · 11 comments
Labels
Question An issue which isn't directly actionable in code

Comments

@David-Else
Copy link

David-Else commented Jun 7, 2018

#51322 microsoft/vscode#51322 (comment)

VSCode Version: 1.24.0
OS Version: Fedora 28

Steps to Reproduce:

npm install vue
try to install the ESM module version of view:

import Vue from '../node_modules/vue/dist/vue.esm.browser.js';

and get error:

[ts]
Could not find a declaration file for module '../node_modules/vue/dist/vue.esm.browser.js'. '(various folders)/node_modules/vue/dist/vue.esm.browser.js' implicitly has an 'any' type.
  Try `npm install @types/vue` if it exists or add a new declaration (.d.ts) file containing `declare module 'vue';`
module "(various folders)/node_modules/vue/dist/vue.esm.browser"

As this is a .js file, I assume it is an error that I now need to supply a declaration file? This just started to happen on the same file the moment after I updated to 1.24

Does this issue occur when all extensions are disabled?: Yes

@mhegazy mhegazy added the Question An issue which isn't directly actionable in code label Jun 7, 2018
@mhegazy
Copy link
Contributor

mhegazy commented Jun 7, 2018

You might have better luck sharing this on StackOverflow. This is not a support forum, it is one for reporting compiler/language bugs and suggestions.
If you believe you are running into a compiler bug, please share a minimal repro project that demonstrates the issue you are running into and why you believe this is a compiler bug and not a declaration file issue or library usage problem.

@David-Else
Copy link
Author

I was told by a Microsoft employee on the vscode forum to post it here. Please see microsoft/vscode#51322 (comment)

I don't want any support, I would like to know why vscode is now asking me for something it was not in the previous version.

@AlCalzone
Copy link
Contributor

Might be related to (or even the same): #24781

@mogarick
Copy link

mogarick commented Jun 8, 2018

Hi,

I was about to file a bug on VSCode Project but I found the original by @David-Else
I'm having the same problem. I'm getting error in my NodeJS files just after updating to VSCode 1.24 with TS 2.9. In my case I'm working on OSX 10.11.6.
Before updating VSCode was working fine. It could infer/find type defs for minio and a custom lib and intellisense was working just fine. But after the update it suddenly stopped working and I'm getting error messages such as:

[ts] Property 'bucketExists' does not exist on type 'Client'.

If I hover over the require I can read the next message:

[ts]
Could not find a declaration file for module 'minio'. '/<myProjectFolderPath>/node_modules/minio/dist/main/minio.js' implicitly has an 'any' type.
  Try `npm install @types/minio` if it exists or add a new declaration (.d.ts) file containing `declare module 'minio';`

Before the update VSCode was correctly resolving the type refs automatically and making Intellisense work like a charm. But now it's broken.

Here is the jsconfig.js file I have. I haven't changed anything on it. It was working fine before the update:

{
    "compilerOptions": {
        "target": "ES6",        
        "allowSyntheticDefaultImports": true,
        "module": "commonjs",
        "moduleResolution": "node",
        "checkJs": true                  
    },
    "exclude": [
        "node_modules",
        "**/node_modules/*"
    ]
    
}

Thank you in advance for any help/hint steps to follow.

@typescript-bot
Copy link
Collaborator

Automatically closing this issue for housekeeping purposes. The issue labels indicate that it is unactionable at the moment or has already been addressed.

@David-Else
Copy link
Author

It seemed to fix itself in 1.24.1

@Trenrod
Copy link

Trenrod commented Jul 5, 2018

Still a problem for me at 1.24.1
Windows 10

@David-Else
Copy link
Author

I was wrong, it did not fix itself in 1.24.1! Fingers crossed for 1.25!!

@yhaiovyi
Copy link

Still the same, why a heck it treats .js as .ts

@RyanCavanaugh
Copy link
Member

We could use a repro here. The one posted by @mogarick has checkJs enabled and it's expected to see appropriate errors if checkJs is enabled.

@RyanCavanaugh
Copy link
Member

Please log a new issue with repro steps if you are able to.

@microsoft microsoft locked as off-topic and limited conversation to collaborators Aug 24, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Question An issue which isn't directly actionable in code
Projects
None yet
Development

No branches or pull requests

8 participants