Visual Studio Code Typings for three.js

At the moment, right now, just while I use three.js together with WebGL to make a simple animation for my contact page, I’m skipping proper tooling and just want to edit JavaScript that uses the three.js library.

Most of the tutorials out there use deprecated functionality and I really really want Intellisense for the current library, so for now, I’ve made a Samba share on my server to edit stuff in production from Windows on Visual Studio Code and I just want to add the typings reference (there is one available). Without setting-up projects / dependencies and so on right now.

Using my every-day VM just because it’s got most of my WordPress/JavaScript stuff on it right now:

  • Mapped \\XARTAV101UD\html to A: (for convenience)
  • prompt>A:
  • A:\>cd xarta
  • Install latest Node
  • A:\xarta>npm install –save latest-version
  • A:\xarta>npm install typings –global
  • A:\xarta>typings init
  • A:\xarta>typings search three
  • A:\xarta>typings install dt~three –save –global
  • Add /// <reference path=”globals/three/index.d.ts” /> to any JavaScript file I want to edit with Intellisense for three.js

The folder “xarta” is just to hold any non-WordPress stuff I want to throw into this blog-site. Yes: I will establish a better formal process when an opportune moment arises.

nb: that stuff about var q = String.fromCharCode(34); in the screenshot was from when I used the WordPress Header / Footer plug-in. The plug-in would render quotation escapes and so on even in the Footer edit area, losing the code. It was the only way round I could think of at the time. The script outgrew that approach also leading to this typings requirement.