summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2026-08-30 11:17:45 +0100
committerMichael Williamson <mike@zwobble.org>2026-08-30 11:17:45 +0100
commita7d5133ac7cc82e3826f90d2e5f1ca5cd3f08676 (patch)
treeda8fa4c132bef9bc34788c2dd817bf7b13c87767 /examples
parent9de4242330fe137133327533f24073613da8d201 (diff)
Export generated TypeScript classes in typescript-types
Diffstat (limited to 'examples')
-rw-r--r--examples/01-struct/output/typescript/package-lock.json18
-rw-r--r--examples/01-struct/output/typescript/src/point.test.ts13
-rw-r--r--examples/01-struct/output/typescript/src/point.ts4
-rw-r--r--examples/templates/typescript/package.json1
-rw-r--r--examples/templates/typescript/tsconfig.json5
5 files changed, 39 insertions, 2 deletions
diff --git a/examples/01-struct/output/typescript/package-lock.json b/examples/01-struct/output/typescript/package-lock.json
index e2f6d78..7de1562 100644
--- a/examples/01-struct/output/typescript/package-lock.json
+++ b/examples/01-struct/output/typescript/package-lock.json
@@ -9,6 +9,7 @@
"version": "0.1.0",
"devDependencies": {
"@types/mocha": "^10.0.10",
+ "@types/node": "^26.4.0",
"mocha": "^11.8.0",
"typescript": "^7.0.2"
}
@@ -49,6 +50,16 @@
"dev": true,
"license": "MIT"
},
+ "node_modules/@types/node": {
+ "version": "26.4.0",
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-26.4.0.tgz",
+ "integrity": "sha512-faiGnoIrLH/V8cibOMEAZ8pMw6oXqSukl29ra4mN8GdaB2ZewzeaLj+INpV5N+Z1eKWzY+IzaIZH2EIR6YZRNQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "undici-types": "~8.3.0"
+ }
+ },
"node_modules/@typescript/typescript-aix-ppc64": {
"version": "7.0.2",
"resolved": "https://registry.npmjs.org/@typescript/typescript-aix-ppc64/-/typescript-aix-ppc64-7.0.2.tgz",
@@ -1346,6 +1357,13 @@
"@typescript/typescript-win32-x64": "7.0.2"
}
},
+ "node_modules/undici-types": {
+ "version": "8.3.0",
+ "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-8.3.0.tgz",
+ "integrity": "sha512-j375ScV60dom+YkPFIfTLcOiPxkN/buHz5GobjLhixFuANaNs3C9l4GmrWqejgXWJ7BbJcFYpTEUkS1Ge8bpZQ==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/which": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
diff --git a/examples/01-struct/output/typescript/src/point.test.ts b/examples/01-struct/output/typescript/src/point.test.ts
index e69de29..d5e8533 100644
--- a/examples/01-struct/output/typescript/src/point.test.ts
+++ b/examples/01-struct/output/typescript/src/point.test.ts
@@ -0,0 +1,13 @@
+import {strictEqual} from "node:assert";
+
+import {test} from "mocha";
+
+import {Point} from "./point.ts";
+
+test("pointFields", () => {
+ var point = new Point(10, 25);
+ var x: number = point.x;
+ var y: number = point.y;
+ strictEqual(x, 10);
+ strictEqual(y, 25);
+});
diff --git a/examples/01-struct/output/typescript/src/point.ts b/examples/01-struct/output/typescript/src/point.ts
index 81f1b83..0e843ce 100644
--- a/examples/01-struct/output/typescript/src/point.ts
+++ b/examples/01-struct/output/typescript/src/point.ts
@@ -14,6 +14,8 @@ class Line {
}
}
+export {Line};
+
/**
* A 2D point.
*/
@@ -27,3 +29,5 @@ class Point {
this.y = y;
}
}
+
+export {Point};
diff --git a/examples/templates/typescript/package.json b/examples/templates/typescript/package.json
index b2bd443..9732b10 100644
--- a/examples/templates/typescript/package.json
+++ b/examples/templates/typescript/package.json
@@ -10,6 +10,7 @@
},
"devDependencies": {
"@types/mocha": "^10.0.10",
+ "@types/node": "^26.4.0",
"mocha": "^11.8.0",
"typescript": "^7.0.2"
}
diff --git a/examples/templates/typescript/tsconfig.json b/examples/templates/typescript/tsconfig.json
index 6a4848a..da0f363 100644
--- a/examples/templates/typescript/tsconfig.json
+++ b/examples/templates/typescript/tsconfig.json
@@ -3,7 +3,7 @@
"compilerOptions": {
"module": "nodenext",
"target": "esnext",
- "types": [],
+ "types": ["node"],
"sourceMap": true,
"declaration": true,
"declarationMap": true,
@@ -16,6 +16,7 @@
"noUncheckedSideEffectImports": true,
"moduleDetection": "force",
"skipLibCheck": true,
- "erasableSyntaxOnly": true
+ "erasableSyntaxOnly": true,
+ "allowImportingTsExtensions": true
}
}