TypeScript Version: 2.3. for Visual Studio 2015u3
Edit
My latest findings:
It seems the external tsconfig is not correctly interpreted with language service:
It seems that some msconfig options does not work in the same way as in case of external tsconfig.
As I am looking to both configs together, can't it be something related to letter case??
Test case:
tsconfig.json
mainmodule.csproj
mainmodule (folder)
index.ts - main module file
submodule (submodule folder)
dosomework.ts (some submodule local code referenced using relative path)
index.ts (submodule main code)
Lets say there is following code in mainmodule.ts
import * as submodule from "mainmodule/submodule";
When I have following, external tsconfig.json (out of other settings):
"module": "amd",
"moduleResolution": "node",
"baseUrl": ".",
The compilation itself works well with no errors, but language service does not work as it is not able to resolve modules correctly. Does the baseUrl really working well under VS?
When I use msconfig with following options:
<TypeScriptBaseUrl>.</TypeScriptBaseUrl>
<TypeScriptModuleKind>AMD</TypeScriptModuleKind>
<TypeScriptModuleResolution>Node</TypeScriptModuleResolution>
Both, compilation and language service are failing.
I would say this is very close to what I wrote before.
I have multiple WebApp with TS projects in VS solution. For each one I have separate tsconfig.json file in the root folder of the project. Some projects reports:
TypeScript Virtual Projects reports
Error TS1148 Cannot use imports, exports, or module augmentations when '--module' is 'none'.
Error TS2307 Cannot find module 'ajsfw'. TypeScript Virtual Projects
but when I try to compile the project everything works correctly and correct output is generated.
It seems the language service is not using correct tsconfig.
the tsconfig extends another and that extends another one. its like that:
tsconfig.json
{ "compileOnSave": true, "extends" : "./tsconfig.Debug.json" }
tsconfig.Debug.json
{
// TypeScript 2.2 compiler configuration
// DEBUG CONFIGURATION
"$schema": "http://json.schemastore.org/tsconfig#",
"extends": "./tsconfig.common.json",
"compilerOptions": {
// generate .d.ts declaration file
"declaration": true,
// generate source maps
"sourceMap": true,
// source map root
"mapRoot": "/js",
// sources root directory
"sourceRoot": "/src/HelloWorld",
// remove comments
"removeComments": false
}
}
tsconfig.common.json
{
// TypeScript 2.2 compiler configuration
// COMMON CONFIGURATION (DEBUG/RELEASE)
"$schema": "http://json.schemastore.org/tsconfig#",
"compilerOptions": {
// output file (single js file will be generated)
"outFile": "./bin/HelloWorld.js",
// target ECMA version
"target": "es5",
// libs to be used during compilation
"lib": [ "dom", "es2015.promise", "es5" ],
// base url of shared bin folder
"baseUrl": "../../../Ajs/bin/",
// moule system to be used (none, AMD, CommonJS, UMD, System, ES2015)
"module": "amd",
// module resolution strategy
"moduleResolution": "node",
// don't emit any output when compilation fails
"noEmitOnError": true,
// don't emit BOM
"emitBOM": false,
// preserve const enums (don't delete from generated code)
"preserveConstEnums": true,
// implicit any
"noImplicitAny": false,
// allow experimental decorators feature
"experimentalDecorators": true
},
"include": [
"../../../Ajs.Lib.ts/bin/ajs.lib.ts.d.ts",
"../../../Ajs/bin/**/*.d.ts",
"./**/*"
],
"exclude": [
"./bin/**/*"
]
}
project.csproj (removed some content files):
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.Default.props" Condition="Exists('$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.Default.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<ProjectGuid>{A7219561-43EA-4176-A598-D0FD51715CA0}</ProjectGuid>
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<OutputPath>bin</OutputPath>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<DebugType>full</DebugType>
<DebugSymbols>true</DebugSymbols>
<TypeScriptToolsVersion>2.3</TypeScriptToolsVersion>
<UseIISExpress>true</UseIISExpress>
<IISExpressSSLPort />
<IISExpressAnonymousAuthentication />
<IISExpressWindowsAuthentication />
<IISExpressUseClassicPipelineMode />
<UseGlobalApplicationHostFile />
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">12.0</VisualStudioVersion>
</PropertyGroup>
<ItemGroup>
<Service Include="{4A0DDDB5-7A95-4FBF-97CC-616D07737A77}" />
</ItemGroup>
<PropertyGroup>
<RootNamespace>HelloWorld</RootNamespace>
</PropertyGroup>
<ItemGroup>
<Content Include="tsconfig.json" />
<None Include="tsconfig.common.json">
<DependentUpon>tsconfig.json</DependentUpon>
</None>
<None Include="tsconfig.Debug.json">
<DependentUpon>tsconfig.json</DependentUpon>
</None>
<None Include="tsconfig.Release.json">
<DependentUpon>tsconfig.json</DependentUpon>
</None>
</ItemGroup>
<ItemGroup>
<TypeScriptCompile Include="HelloWorldApplication.ts" />
</ItemGroup>
<ItemGroup />
<ItemGroup>
<ProjectReference Include="..\..\..\Ajs\Ajs.csproj">
<Project>{267086da-ab24-4d8d-bd5f-d7d3b3d7db67}</Project>
<Name>Ajs</Name>
</ProjectReference>
</ItemGroup>
<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
<TypeScriptRemoveComments>false</TypeScriptRemoveComments>
<TypeScriptSourceMap>true</TypeScriptSourceMap>
<TypeScriptTarget>ES5</TypeScriptTarget>
<TypeScriptJSXEmit>React</TypeScriptJSXEmit>
<TypeScriptCompileOnSaveEnabled>True</TypeScriptCompileOnSaveEnabled>
<TypeScriptNoImplicitAny>False</TypeScriptNoImplicitAny>
<TypeScriptModuleKind>None</TypeScriptModuleKind>
<TypeScriptOutFile>
</TypeScriptOutFile>
<TypeScriptOutDir />
<TypeScriptGeneratesDeclarations>True</TypeScriptGeneratesDeclarations>
<TypeScriptNoEmitOnError>True</TypeScriptNoEmitOnError>
<TypeScriptMapRoot>
</TypeScriptMapRoot>
<TypeScriptSourceRoot>
</TypeScriptSourceRoot>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
<TypeScriptRemoveComments>true</TypeScriptRemoveComments>
<TypeScriptSourceMap>false</TypeScriptSourceMap>
<TypeScriptTarget>ES5</TypeScriptTarget>
<TypeScriptJSXEmit>None</TypeScriptJSXEmit>
<TypeScriptCompileOnSaveEnabled>True</TypeScriptCompileOnSaveEnabled>
<TypeScriptNoImplicitAny>False</TypeScriptNoImplicitAny>
<TypeScriptModuleKind>None</TypeScriptModuleKind>
<TypeScriptOutFile>.</TypeScriptOutFile>
<TypeScriptOutDir />
<TypeScriptGeneratesDeclarations>True</TypeScriptGeneratesDeclarations>
<TypeScriptNoEmitOnError>True</TypeScriptNoEmitOnError>
<TypeScriptMapRoot />
<TypeScriptSourceRoot />
</PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\WebApplications\Microsoft.WebApplication.targets" Condition="Exists('$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\WebApplications\Microsoft.WebApplication.targets')" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.targets" Condition="Exists('$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.targets')" />
<ProjectExtensions>
<VisualStudio>
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
<WebProjectProperties>
<UseIIS>True</UseIIS>
<AutoAssignPort>True</AutoAssignPort>
<DevelopmentServerPort>0</DevelopmentServerPort>
<DevelopmentServerVPath>/</DevelopmentServerVPath>
<IISUrl>http://localhost:21281/</IISUrl>
<NTLMAuthentication>False</NTLMAuthentication>
<UseCustomServer>False</UseCustomServer>
<CustomServerUrl>
</CustomServerUrl>
<SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
</WebProjectProperties>
</FlavorProperties>
</VisualStudio>
</ProjectExtensions>
</Project>
TypeScript Version: 2.3. for Visual Studio 2015u3
Edit
My latest findings:
It seems the external tsconfig is not correctly interpreted with language service:
It seems that some msconfig options does not work in the same way as in case of external tsconfig.
As I am looking to both configs together, can't it be something related to letter case??
Test case:
Lets say there is following code in mainmodule.ts
When I have following, external tsconfig.json (out of other settings):
The compilation itself works well with no errors, but language service does not work as it is not able to resolve modules correctly. Does the baseUrl really working well under VS?
When I use msconfig with following options:
Both, compilation and language service are failing.
I would say this is very close to what I wrote before.
I have multiple WebApp with TS projects in VS solution. For each one I have separate tsconfig.json file in the root folder of the project. Some projects reports:
TypeScript Virtual Projects reports
but when I try to compile the project everything works correctly and correct output is generated.
It seems the language service is not using correct tsconfig.
the tsconfig extends another and that extends another one. its like that:
tsconfig.json
tsconfig.Debug.json
tsconfig.common.json
project.csproj (removed some content files):