-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Question : Is typescript compiler can compile javascript files instead typescript files? #14536
Comments
It can. Have you tried You will want to set |
I tried allowJs flag, but it does not work in Visual Studio |
what do you mean by does not work? how are you calling the compiler? |
I rechecked again. The allowJs flag does not works in saving a file in VS2015 Update3 {
"compileOnSave": true,
"compilerOptions": {
"noImplicitAny": false,
"noEmitOnError": false,
"removeComments": false,
"sourceMap": true,
"listEmittedFiles": true,
"target": "es5",
"lib": [
"dom",
"es5",
"es2015.promise"
],
"outDir": "./html/js",
"allowJs": true
},
"include": [
"./html/ts/*"
],
"exclude": [
"node_modules",
"wwwroot"
]
} |
Compile-on-save will not work for .js files in VS 2015; this should be supported in VS 2017 now. Build should generate the files in both versions. |
You are right. Build work, compile on save does not work. Is there any plans to fix this issue? |
The fix requires some major rearchitecture of both the JS and TS language services in VS; something that we already have done in VS 2017, and have no plans to back-port to VS 2015 at the time being. |
Thanks for your answer. |
@mhegazy Is this enabled by default in VS 2017? I noticed a bunch of javascript files generated a corresponding |
if your project has both |
I am not using the <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Build|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<TypeScriptTarget>ES5</TypeScriptTarget>
<TypeScriptJSXEmit>React</TypeScriptJSXEmit>
<TypeScriptCompileOnSaveEnabled>True</TypeScriptCompileOnSaveEnabled>
<TypeScriptNoImplicitAny>True</TypeScriptNoImplicitAny>
<TypeScriptModuleKind>CommonJS</TypeScriptModuleKind>
<TypeScriptRemoveComments>False</TypeScriptRemoveComments>
<TypeScriptOutFile />
<TypeScriptOutDir />
<TypeScriptGeneratesDeclarations>False</TypeScriptGeneratesDeclarations>
<TypeScriptNoEmitOnError>True</TypeScriptNoEmitOnError>
<TypeScriptSourceMap>True</TypeScriptSourceMap>
<TypeScriptMapRoot />
<TypeScriptSourceRoot />
</PropertyGroup> I believe it might be related to #14565 but the other reason might be if the default is now true in VS 2017 when it was false in VS 2015 (TS 1.8). |
@styfle can you elaborate on the details of the issues you are seeing? you have .js files in your project, when you save them, you see output generated for them in your |
|
I am not using a bin folder. The Steps to reproduceI opened an existing 2015 project in VS 2017, edited a Then I looked at git changes in Team Explorer tab and I can see that a bunch of |
@styfle VS should not be compiling those files on save. I'll try and repro the issue you are seeing, but in case I am unable to, if you have a repro project you can share that would be helpful. Thanks. |
@styfle I just tried this with your project settings and didn't see the issue. A couple requests:
Thanks. |
For reference, I opened #14827 |
Will be nice if typescript compiler can compile javascript code instead typescript.
We would like to start to use the async\await syntax only with ES5 target and use as input the js files.
The text was updated successfully, but these errors were encountered: