1

I have been converting an existing Javascript application to Typescript. I started with the DataController, one of the most used classes in the app. I added it to my tsd.d.ts file and added a reference tag at the top, but I do not get autocompletion in the existing Javascript file where the DataController is instantiated.

Am I doing something wrong, or does Typescript only provide autocompletion in other Typescript files?

I am using VSCode.

4
  • Your source file must have a .ts extension. Commented Jun 16, 2015 at 2:12
  • Do you mean the file where DataController is declared must have a .ts extension or the file where it is instantiated must have one? I set the .ts extension on the former but not on the latter Commented Jun 16, 2015 at 2:14
  • 1
    Yes the file you instantiate it. The Typescript compiler only works on .ts files. You can only reference other .ts files or write code in .ts files to get the compiler benefits. It doesn't do anything with .js files. Commented Jun 16, 2015 at 2:18
  • @pixelmike Add it as an answer and I will accept it Commented Jun 16, 2015 at 20:29

1 Answer 1

2

does Typescript only provide autocompletion in other Typescript files?

Yes

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

Comments

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.