Attempt to support TypeScript for coding challenges

I was a bit weaker than I expected to be in my most recent interview using
TypeScript. To improve, I think I'd like to attempt solving some of the
InterviewCake.com questions using TypeScript.

If you've read the previous commits, the inspiration for `run` arose because I
need to call `npx ts-code <file>`, which is easy enough to remember, but I'd
still rather just call `run <file>`.
This commit is contained in:
William Carroll 2020-02-11 17:07:04 +00:00
parent 3afb56a5e5
commit 85cdd46f00
6 changed files with 107 additions and 0 deletions

1
.gitignore vendored
View file

@ -29,3 +29,4 @@ __pycache__
/monzo_ynab/ynab/fixture.json
/monzo_ynab/monzo/fixture.json
/monzo_ynab/kv.json
node_modules/

2
deepmind/part_two/.envrc Normal file
View file

@ -0,0 +1,2 @@
source_up
eval "$(lorri direnv)"

73
deepmind/part_two/package-lock.json generated Normal file
View file

@ -0,0 +1,73 @@
{
"name": "deepmind-part-two",
"version": "1.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"arg": {
"version": "4.1.3",
"resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz",
"integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==",
"dev": true
},
"buffer-from": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz",
"integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==",
"dev": true
},
"diff": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz",
"integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==",
"dev": true
},
"make-error": {
"version": "1.3.5",
"resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.5.tgz",
"integrity": "sha512-c3sIjNUow0+8swNwVpqoH4YCShKNFkMaw6oH1mNS2haDZQqkeZFlHS3dhoeEbKKmJB4vXpJucU6oH75aDYeE9g==",
"dev": true
},
"source-map": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
"dev": true
},
"source-map-support": {
"version": "0.5.16",
"resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.16.tgz",
"integrity": "sha512-efyLRJDr68D9hBBNIPWFjhpFzURh+KJykQwvMyW5UiZzYwoF6l4YMMDIJJEyFWxWCqfyxLzz6tSfUFR+kXXsVQ==",
"dev": true,
"requires": {
"buffer-from": "^1.0.0",
"source-map": "^0.6.0"
}
},
"ts-node": {
"version": "8.6.2",
"resolved": "https://registry.npmjs.org/ts-node/-/ts-node-8.6.2.tgz",
"integrity": "sha512-4mZEbofxGqLL2RImpe3zMJukvEvcO1XP8bj8ozBPySdCUXEcU5cIRwR0aM3R+VoZq7iXc8N86NC0FspGRqP4gg==",
"dev": true,
"requires": {
"arg": "^4.1.0",
"diff": "^4.0.1",
"make-error": "^1.1.1",
"source-map-support": "^0.5.6",
"yn": "3.1.1"
}
},
"typescript": {
"version": "3.7.5",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.7.5.tgz",
"integrity": "sha512-/P5lkRXkWHNAbcJIiHPfRoKqyd7bsyCma1hZNUGfn20qm64T6ZBlrzprymeu918H+mB/0rIg2gGK/BXkhhYgBw==",
"dev": true
},
"yn": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz",
"integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==",
"dev": true
}
}
}

View file

@ -0,0 +1,15 @@
{
"name": "deepmind-part-two",
"version": "1.0.0",
"description": "Practicing coding interview questions",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "William Carroll",
"license": "MIT",
"devDependencies": {
"ts-node": "^8.6.2",
"typescript": "^3.7.5"
}
}

View file

@ -0,0 +1,6 @@
function main(x: number) {
console.log(x + 1);
console.log("Hello, world.");
}
main(10);

View file

@ -0,0 +1,10 @@
{ pkgs ? import <nixpkgs> {}, ... }:
pkgs.mkShell {
buildInputs = with pkgs; [
nodejs
python3
go
goimports
];
}