TypeScript Coding Editor for Technical Interviews

Running TypeScript v4 under Node.js v16 - Autocomplete is not available

TypeScript in CoderPad runs on top of the JavaScript environment.

Click “Run” to execute your code and see any type errors. We do not yet support inline diagnostics in the editor in TypeScript. (If you don’t see a “Run” button, your interviewer may have disabled execution.)

We also have an array of interesting npm packages available for your use:

  • underscore and lodash for many useful functional helpers.
  • chaisinon, and sinon-chai testing libraries.
  • asyncrequest, and isomorphic-fetch for making async HTTP a little more convenient.
  • jsdom is a library for mimicking an HTML DOM within our JS environment. Useful if you want to test how candidates can manipulate elements without using our full HTML/CSS/JS environment.

Note that packages must be require()ed, not imported.

Here’s an example of a test using Chai:

const chai = require('chai') const sinon = require('sinon') const sinonChai = require('sinon-chai') chai.should() chai.use(sinonChai) function hello(name: string, cb) { cb('hello ' + name) } var cb = sinon.spy() hello('world', cb) cb.should.have.been.calledWith('hello world') cb.should.have.been.calledWith('this test should fail')
Code language: TypeScript (typescript)

Try Our TypeScript Editor