From b12ba90430b398e114d4b2ca7f573d9966814f03 Mon Sep 17 00:00:00 2001 From: Evan Broder Date: Sat, 23 Dec 2023 09:01:31 -0800 Subject: [PATCH] Re-enable TypeScript self-test The latest release of zodern:types is able to pull type declarations from a Meteor checkout, if it's being used, instead of only from the package repository (which may not contain the latest changes). This means that we should be able to re-enable the TypeScript test, which verifies that the TypeScript skeleton does, in fact, produce a project which passes type checking. (Re-enabling the test also picked up a few latent bugs in the type declarations, so fix those as well) --- packages/logging/logging.d.ts | 2 +- packages/meteor/meteor.d.ts | 2 +- tools/tests/typescript.js | 54 +++++++++++++++++------------------ 3 files changed, 29 insertions(+), 29 deletions(-) diff --git a/packages/logging/logging.d.ts b/packages/logging/logging.d.ts index 80a92e728b5c..5f445e692d8f 100644 --- a/packages/logging/logging.d.ts +++ b/packages/logging/logging.d.ts @@ -1,7 +1,7 @@ type LogJSONInput = { message: string; app?: string; - [index: string]: string | object | number; + [index: string]: string | object | number | undefined; }; type LogInput = string | LogJSONInput; diff --git a/packages/meteor/meteor.d.ts b/packages/meteor/meteor.d.ts index ad3b50e01858..2249f8891466 100644 --- a/packages/meteor/meteor.d.ts +++ b/packages/meteor/meteor.d.ts @@ -241,7 +241,7 @@ export namespace Meteor { >( name: string, args: ReadonlyArray, - options?: MethodApplyOptions, + options?: MethodApplyOptions, asyncCallback?: ( error: global_Error | Meteor.Error | undefined, result?: Result diff --git a/tools/tests/typescript.js b/tools/tests/typescript.js index 2828cc6a2b7b..420f0a51eafe 100644 --- a/tools/tests/typescript.js +++ b/tools/tests/typescript.js @@ -1,27 +1,27 @@ -// var selftest = require('../tool-testing/selftest.js'); -// var Sandbox = selftest.Sandbox; -// -// selftest.define("typescript template works", function () { -// const s = new Sandbox; -// -// let run = s.run("create", "--typescript", "typescript"); -// -// run.waitSecs(60); -// run.match("Created a new Meteor app in 'typescript'."); -// run.match("To run your new app"); -// -// s.cd("typescript"); -// -// run = s.run("npm", "install"); -// run.expectExit(0); -// -// run = s.run("lint"); -// run.waitSecs(60); -// run.match("[zodern:types] Exiting \"meteor lint\" early"); -// run.expectExit(0); -// -// run = s.run("npx", "tsc"); -// run.waitSecs(60); -// run.expectEnd(); -// run.expectExit(0); -// }); +var selftest = require('../tool-testing/selftest.js'); +var Sandbox = selftest.Sandbox; + +selftest.define("typescript template works", function () { + const s = new Sandbox; + + let run = s.run("create", "--typescript", "typescript"); + + run.waitSecs(60); + run.match("Created a new Meteor app in 'typescript'."); + run.match("To run your new app"); + + s.cd("typescript"); + + run = s.run("npm", "install"); + run.expectExit(0); + + run = s.run("lint"); + run.waitSecs(60); + run.match("[zodern:types] Exiting \"meteor lint\" early"); + run.expectExit(0); + + run = s.run("npx", "tsc"); + run.waitSecs(60); + run.expectEnd(); + run.expectExit(0); +});