Skip to content
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

Error after installing TS 1.8 beta through Nuget #6929

Closed
smithkl42 opened this issue Feb 5, 2016 · 10 comments
Closed

Error after installing TS 1.8 beta through Nuget #6929

smithkl42 opened this issue Feb 5, 2016 · 10 comments
Labels
Duplicate An existing issue was already created Needs More Info The issue still hasn't been fully clarified

Comments

@smithkl42
Copy link

I have a largish solution that was working correctly with TS 1.7. I installed the beta of TS 1.8 through the nuget packages (https://www.nuget.org/packages/Microsoft.TypeScript.Compiler/1.8.0-beta and https://www.nuget.org/packages/Microsoft.TypeScript.MSBuild/1.8.0-beta). After installing these, when I build my solution, I get this error:

Description: Build: File 'COMPUTE_PATHS_ONLY.ts' not found
Project: Swyfft.Web
File: VSTSC

No idea what's up. Any suggestions for troubleshooting?

@mhegazy
Copy link
Contributor

mhegazy commented Feb 5, 2016

do you still have imports to $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.targets" somewhere in your project file?

if so, please see the steps in https://github.com/Microsoft/TypeScript/wiki/Configuring-MSBuild-projects-to-use-NuGet, the next release should take care of this for you automatically.

@mhegazy mhegazy added the Needs More Info The issue still hasn't been fully clarified label Feb 5, 2016
@smithkl42
Copy link
Author

Well, that got rid of that error - thanks! I'd googled, but hadn't initially spotted that link.

But after I got rid of that error, when I built my project, I got several hundred other build errors that didn't initially strike me as correct. I'll hold off on migrating to 1.8 for now, I think :-). (I'd wanted the string literal types, but I can make it work with hacking enums to do what I need.)

@mhegazy
Copy link
Contributor

mhegazy commented Feb 6, 2016

what errors are you seeing?

@mhegazy
Copy link
Contributor

mhegazy commented Feb 6, 2016

and what version are you upgrading from?

@smithkl42
Copy link
Author

I'm upgrading from 1.7.6. But after following the instructions in the link above, I'm still not able to use TS 1.8 features. For instance, this is from the sample code for string literal types (#5185):

type CardinalDirection = "North"
    | "East"
    | "South"
    | "West";

But when I put that into my project after upgrading, I get these error messages:

Error TS2362 The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. Swyfft.Web C:\source\swyfft\swyf-website\Swyfft.Web\App\Scratch.ts 17 Active
Error TS2363 The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. Swyfft.Web C:\source\swyfft\swyf-website\Swyfft.Web\App\Scratch.ts 18 Active
Error TS2363 The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. Swyfft.Web C:\source\swyfft\swyf-website\Swyfft.Web\App\Scratch.ts 19 Active
Error TS2363 The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. Swyfft.Web C:\source\swyfft\swyf-website\Swyfft.Web\App\Scratch.ts 20 Active

When I last did it, I also managed to get a whole bunch of errors insisting that various items referenced in DefinitelyTyped files were undefined (e.g., ko.observable(), that sort of thing). But I'm not seeing that right now at least.

@mhegazy
Copy link
Contributor

mhegazy commented Feb 6, 2016

But when I put that into my project after upgrading, I get these error messages:

the errors are about comparison locations, can you post a sample of the comparison you are doing. the error does not tell me what you were trying to do.

When I last did it, I also managed to get a whole bunch of errors insisting that various items referenced in DefinitelyTyped files were undefined (e.g., ko.observable(), that sort of thing). But I'm not seeing that right now at least.

what do you mean by "undefined"? at runtime? or were there a compiler crash?

@smithkl42
Copy link
Author

Sorry, what I meant is that after I upgraded, when I created a simple file that looks like this:

type CardinalDirection = "North"
    | "East"
    | "South"
    | "West";

The compiler threw the errors above. In other words, I don't think it was actually using the TS 1.8 compiler: my guess is that Visual Studio is still using the 1.7 compiler (which shows exactly the same error messages for that code).

With respect to the other errors, I think the actual error was "Cannot resolve symbol". In other words, in a line like:

var x = ko.observable('');

Where ko was defined in (say) knockout.d.ts, it would highlight ko and give the error "Cannot resolve symbol 'ko'". But like I said, the last time I tried it, I couldn't get it to repro that specific error.

@mhegazy
Copy link
Contributor

mhegazy commented Feb 7, 2016

Are the errors in VS? or when you build?

if it is from the build, can you look at the build log (tools\options\Projects and Solutions\Build and Run\MSBuild project build output verbosity, and chose Detailed), and see where tsc.exe is called from?

if it is from VS, did you install TS 1.8 VS plugin?

@smithkl42
Copy link
Author

The errors are showing up both in VS (i.e., with the little red squigglies on my code) and when I build.

It looks like it's using the 1.7.6 version of the compiler:

Using "VsTsc" task from assembly "C:\source\swyfft\swyf-website\packages\Microsoft.TypeScript.MSBuild.1.8.0-beta\tools\TypeScript.tasks.dll".
Task "VsTsc"
C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.7\tsc.exe --sourcemap --target ES5 --noEmitOnError --locale en-US (....)
Done executing task "VsTsc".

And no, I didn't install the TS 1.8 VS plugin - my assumption (perhaps flawed) was that the point of the nuget package was so VS would use the nuget package over what was installed on my machine. So I've still got the 1.7.6 plugin installed.

This does raise a question that had me confused, namely, what the point of having two different nuget packages was. The instructions you pointed to earlier ( https://github.com/Microsoft/TypeScript/wiki/Configuring-MSBuild-projects-to-use-NuGet) only talk about installing the Microsoft.TypeScript.MsBuild task. I did that, but also installed the Microsoft.TypeScript.Compiler task - wasn't sure if that was correct or not, but it seemed appropriate. But perhaps I'm misunderstanding something.

@mhegazy
Copy link
Contributor

mhegazy commented Feb 8, 2016

you only need the MSBuild one. it subsumed the Complier package.

i think what you are running into is #6715. try upgrading to the nightly Nuget packge on Myget and the errors should go away.

@mhegazy mhegazy closed this as completed Feb 8, 2016
@mhegazy mhegazy added the Duplicate An existing issue was already created label Feb 8, 2016
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Duplicate An existing issue was already created Needs More Info The issue still hasn't been fully clarified
Projects
None yet
Development

No branches or pull requests

2 participants