Skip to content

Commit 49305e4

Browse files
committed
in which Jess finds a case where named imports are necessary
and bad. don't set the exports to a single thing, just don't
1 parent 25940c9 commit 49305e4

File tree

13 files changed

+280
-1
lines changed

13 files changed

+280
-1
lines changed

.vscode/launch.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"type": "node",
6+
"request": "launch",
7+
"name": "Launch current file w/ ts-node",
8+
"protocol": "inspector",
9+
"args": [
10+
"${workspaceRoot}/src/cli/explore.ts"
11+
],
12+
"cwd": "${workspaceRoot}",
13+
"runtimeArgs": [
14+
"-r",
15+
"ts-node/register"
16+
],
17+
"internalConsoleOptions": "openOnSessionStart"
18+
}
19+
]
20+
}

.vscode/tasks.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
// See https://go.microsoft.com/fwlink/?LinkId=733558
3+
// for the documentation about the tasks.json format
4+
"version": "2.0.0",
5+
"tasks": [
6+
{
7+
"type": "typescript",
8+
"tsconfig": "tsconfig.json",
9+
"problemMatcher": [
10+
"$tsc"
11+
],
12+
"group": {
13+
"kind": "build",
14+
"isDefault": true
15+
}
16+
}
17+
]
18+
}

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ Cover:
2525
- type parameters and defaults
2626
- interfaces
2727
- classes and the tricky bit about private fields
28+
- vscode: type hints, useful error messages
2829

2930

3031
## Section 2: The runtime. Node and the many dialects of JavaScript
@@ -40,9 +41,18 @@ Cover:
4041
- imports in TypeScript
4142
- declaring dependencies. 3 types
4243
- what npm does and how to decipher what it does
44+
- output: outDir or outFile (amd or system module output only)
4345

4446
## Section 4: Leveraging TypeScript to find bugs
4547

4648
- stricter compiler options
4749
- testing
50+
- ts-node/register
4851
- tslint
52+
### Compiler options
53+
- "lib" brings in type definitions
54+
- skipLibChecks lets you not worry about perfect compatibility with every freaking library everywhere
55+
56+
57+
useful:
58+
- https://blog.angular-university.io/typescript-2-type-system-how-do-type-definitions-work-in-npm-when-to-use-types-and-why-what-are-compiler-opt-in-types/

build/cli/explore.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/env ts-node
2+
"use strict";
3+
Object.defineProperty(exports, "__esModule", { value: true });
4+
const youAreIn_1 = require("./support/youAreIn");
5+
youAreIn_1.youAreIn(process.cwd());
6+
console.log("everything is fucked here");

build/cli/support/youAreIn.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
"use strict";
2+
var __importDefault = (this && this.__importDefault) || function (mod) {
3+
return (mod && mod.__esModule) ? mod : { "default": mod };
4+
};
5+
Object.defineProperty(exports, "__esModule", { value: true });
6+
const jetty_1 = __importDefault(require("jetty"));
7+
function youAreIn(appDir) {
8+
var jetty = new jetty_1.default(process.stdout);
9+
jetty.text("Hello from " + appDir);
10+
console.log("fuck you");
11+
// Clear the screen
12+
jetty.clear();
13+
// Draw a circle with fly colours
14+
var i = 0;
15+
setInterval(function () {
16+
i += 0.025;
17+
var x = Math.round(Math.cos(i) * 25 + 50), y = Math.round(Math.sin(i) * 13 + 20);
18+
jetty.rgb(Math.round(Math.random() * 215), Math.random() > 0.5).moveTo([y, x]).text(".");
19+
}, 5);
20+
}
21+
exports.youAreIn = youAreIn;

build/index.js

Whitespace-only changes.

package-lock.json

Lines changed: 96 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,13 @@
33
"version": "1.0.0",
44
"description": "Examples for a talk",
55
"main": "build/index.js",
6+
"types": "build/index.d.ts",
67
"scripts": {
78
"test": "mocha --require ts-node/register 'test/**/*.ts'"
89
},
10+
"bin": {
11+
"explore": "build/cli/explore.js"
12+
},
913
"repository": {
1014
"type": "git",
1115
"url": "git+https://github.com/jessitron/about-typescript.git"
@@ -17,6 +21,11 @@
1721
},
1822
"homepage": "https://github.com/jessitron/about-typescript#readme",
1923
"dependencies": {
24+
"jetty": "^0.2.1"
25+
},
26+
"devDependencies": {
27+
"@types/node": "^10.5.2",
28+
"ts-node": "^7.0.0",
2029
"typescript": "^2.9.2"
2130
}
22-
}
31+
}

src/cli/explore.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/usr/bin/env ts-node
2+
3+
import { youAreIn } from "./support/youAreIn";
4+
5+
youAreIn(process.cwd());
6+
7+
console.log("everything is fucked here")

src/cli/support/youAreIn.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
2+
import Jetty from "jetty";
3+
4+
export function youAreIn(appDir: string) {
5+
6+
var jetty = new Jetty(process.stdout)
7+
8+
jetty.text("Hello from " + appDir);
9+
10+
console.log("fuck you")
11+
12+
// Clear the screen
13+
jetty.clear();
14+
15+
// Draw a circle with fly colours
16+
var i = 0;
17+
setInterval(function () {
18+
i += 0.025;
19+
20+
var x = Math.round(Math.cos(i) * 25 + 50),
21+
y = Math.round(Math.sin(i) * 13 + 20);
22+
23+
jetty.rgb(
24+
Math.round(Math.random() * 215),
25+
Math.random() > 0.5
26+
).moveTo([y, x]).text(".");
27+
}, 5);
28+
}

0 commit comments

Comments
 (0)