Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Typescript compiling and changing filenames to lowercase all the time (VS2015)

I am using the latest VS2015 with the following options set in my project file for typescript:

  <PropertyGroup>
    <TypeScriptTarget>ES5</TypeScriptTarget>
    <TypeScriptCompileOnSaveEnabled>true</TypeScriptCompileOnSaveEnabled>
    <TypeScriptNoImplicitAny>false</TypeScriptNoImplicitAny>
    <TypeScriptModuleKind>AMD</TypeScriptModuleKind>
    <TypeScriptRemoveComments>false</TypeScriptRemoveComments>
    <TypeScriptOutFile></TypeScriptOutFile>
    <TypeScriptOutDir></TypeScriptOutDir>
    <TypeScriptGeneratesDeclarations>false</TypeScriptGeneratesDeclarations>
    <TypeScriptSourceMap>true</TypeScriptSourceMap>
    <TypeScriptMapRoot></TypeScriptMapRoot>
    <TypeScriptSourceRoot></TypeScriptSourceRoot>
    <TypeScriptNoEmitOnError>true</TypeScriptNoEmitOnError>
</PropertyGroup>

My problem is when it compiles a file:

UserService.ts it creates a userservice.js and a userservice.js.map

Which then contains //# sourceMappingURL=userservice.js.map

the userservice.js.map then has this line:

sources":["userservice.ts"]

Has anyone else seen this? I have tried recreating the files and same. This is causing me a lot of problems.

Follow up:

When I create a typescript file UserServicexxxx.ts everything works. When I delete all UserService files and create a UserService.ts then it goes back to doing what it did before.

I've been struggling now for 30 minutes or more trying to create UserService.ts, UserService.js and UserService.js.map :-(

like image 866
Samantha J T Star Avatar asked Jul 04 '15 05:07

Samantha J T Star


1 Answers

This issue may be the cause: https://github.com/Microsoft/TypeScript/issues/2011

Have you checked that any files you reference UserService.ts from are correctly cased? If they are cased userservice.ts, it will compile to userservice.js, regardless of the actual casing of the ts file. They don't check this right now for performance reasons, but it creates odd bugs like this.

Clean your project and do a search for 'userservice.ts'. If you find one, change the case to the proper CamelCasing and recompile.

I've repro'd this issue here:

UserService.ts

UserService.ts

userService.ts

userService.ts

userservice.ts

userservice.ts

Check extra hard for any lingering links!

like image 118
Chris Anderson-AWS Avatar answered Nov 15 '22 06:11

Chris Anderson-AWS