-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
Typescript Import function gets compiler error in Visual Studio #19337
Comments
Use |
You should not need to install From the description above, VS is not using TS 2.4. can you share your project file? |
Hi mhegazy - here is my csproj file:
|
I am unable to reproduce this locally with this file. can you share the full project, or a sample project that shows the issue? Also noticed that your tsconfig.json is not referenced from the project file above, is this the same project? |
The tsconfig is included in the project. I'm not sure why it does not show in the proj file. I should mention that other developers working on the exact same project do not get this error, so it must be something to do with my local environment. |
@prsmith1 Might you have the wrong TypeScript settings configured in your .csproj? I see that you have |
@aluanhaddad I have tried '2.3' and 'Use latest available' (we are using 2.4), but it didn't make any difference. Looking at my extensions, the 'TypeScript Build for Microsoft Visual Studio' and 'TypeScript for Microsoft Visual Studio' extensions are both on 15.3.10723.1 and are set to auto update, so I think they're okay too. |
Well, it will not work with '2.3' and I was thinking that you might have an older version of the SDK installed and that 'latest' might be mapping to '<2.4'. |
Automatically closing this issue for housekeeping purposes. The issue labels indicate that it is unactionable at the moment or has already been addressed. |
This question was first posted here: https://stackoverflow.com/questions/46827184/typescript-import-function-gets-compiler-error/46827260?noredirect=1#46827260
In my Typescript I am using the import function as described here:
#12933
So my code is like:
import("../myScriptToBeImported").then((module) => {this.dosomethingWithModule(module); }).catch(this.doSomethingWithError.bind(this));
I am running this as part of an MVC project in Visual Studio with Webpack. Webpack compiles the Typescript without any errors and the project runs fine, yet for the above line the following errors are always shown in Visual Studio:
I am using Typescript version 2.4.2. How can I get rid of these errors?
For information, my tsconfig file looks like this:
{ "compilerOptions": { "module": "esnext", "moduleResolution": "node", "noEmitOnError": true, "strict": true, "removeComments": false, "sourceMap": true, "target": "es5", "typeRoots": [ "node_modules/@types" ], "lib": [ "es6", "dom" ], "baseUrl": ".", "experimentalDecorators": true, "emitDecoratorMetadata": true }, "exclude": [ "node_modules", "wwwroot" ], "compileOnSave": false, "buildOnSave": false }
The text was updated successfully, but these errors were encountered: