0

In Visual Studio, I create an default TypeScript site.

I then use Nuget to add jquery.d.ts.

I then compile the app.

The error window shows me 101 Errors in the jquery.d.ts file such as:

Error   341 ',' expected.

How do I resolve these errors?

Have I incorrectly imported the file, or is there some setting I need to set?

The actual error as shown in the UI says:

A parameterized initializer is only allowed in a function or constructor implementation.

On this line:

replaceAll(target: JQuery|any[]|Element|string): JQuery;

1 Answer 1

1

You're probably using an old version of TypeScript compiler. Union types (that is JQuery|any[]|Element|string) are only available since TypeScript 1.4

Try updating TypeScript for Visual Studio.

Sign up to request clarification or add additional context in comments.

1 Comment

I have the same issue, but when using Visual Studio Update 5. It suggests against manually updating TypeScript and sticking with the version built into Updae 5.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.