diff --git a/package.json b/package.json index a7b4382e549d..409ef8012a2b 100644 --- a/package.json +++ b/package.json @@ -38,6 +38,7 @@ "@rollup/plugin-json": "^4.1.0", "@rollup/plugin-node-resolve": "^13.0.0", "@rollup/plugin-replace": "^2.4.2", + "@types/node": "^16.7.13", "@typescript-eslint/eslint-plugin": "^4.18.0", "@typescript-eslint/parser": "^4.18.0", "babel-plugin-transform-charcodes": "^0.2.0", diff --git a/packages/babel-helper-transform-fixture-test-runner/src/index.ts b/packages/babel-helper-transform-fixture-test-runner/src/index.ts index ca938f2497a3..a6cc7507817c 100644 --- a/packages/babel-helper-transform-fixture-test-runner/src/index.ts +++ b/packages/babel-helper-transform-fixture-test-runner/src/index.ts @@ -23,7 +23,10 @@ const checkDuplicatedNodes = _checkDuplicatedNodes.default; const EXTERNAL_HELPERS_VERSION = "7.100.0"; -const cachedScripts = new QuickLRU({ maxSize: 10 }); +const cachedScripts = new QuickLRU< + string, + { code: string; cachedData?: Buffer } +>({ maxSize: 10 }); const contextModuleCache = new WeakMap(); const sharedTestContext = createContext(); @@ -79,12 +82,10 @@ function createContext() { function runCacheableScriptInTestContext( filename: string, srcFn: () => string, - // todo(flow->ts) was Context type, but it is missing - context: any, + context: vm.Context, moduleCache: any, ) { - // todo(flow->ts) improve types - let cached: any = cachedScripts.get(filename); + let cached = cachedScripts.get(filename); if (!cached) { const code = `(function (exports, require, module, __filename, __dirname) {\n${srcFn()}\n});`; cached = { @@ -102,9 +103,7 @@ function runCacheableScriptInTestContext( produceCachedData: true, }); - // @ts-expect-error todo(flow->ts) improve types if (script.cachedDataProduced) { - // @ts-expect-error todo(flow->ts) improve types cached.cachedData = script.cachedData; } @@ -129,8 +128,7 @@ function runCacheableScriptInTestContext( function runModuleInTestContext( id: string, relativeFilename: string, - // todo(flow->ts) was Context type, but it is missing - context: any, + context: vm.Context, moduleCache: any, ) { const filename = require.resolve(id, { @@ -490,7 +488,7 @@ export default function ( // the options object with useless options delete task.options.throws; - assert.throws(runTask, function (err) { + assert.throws(runTask, function (err: Error) { assert.ok( throwMsg === true || err.message.includes(throwMsg), ` diff --git a/yarn.lock b/yarn.lock index 03835d132d9c..433e61d69d60 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4242,10 +4242,10 @@ __metadata: languageName: node linkType: hard -"@types/node@npm:*": - version: 14.14.31 - resolution: "@types/node@npm:14.14.31" - checksum: 635dc8a0898a923621e02ca179e17baa39fdfa44f0096fcc1b7046c9b32317e74a99956a7b45ca0e8069874f51f4e7873a418239a318a4b6e7936f6510ac5992 +"@types/node@npm:*, @types/node@npm:^16.7.13": + version: 16.7.13 + resolution: "@types/node@npm:16.7.13" + checksum: e22d3b58e5c4b18d058b18ab75bb1bf27b2dcb83b798eac3cdb7a3b12725f7ee1343abc7b5d020d39869669045654ce7d38e952832a1f39f061da0fbebbf43df languageName: node linkType: hard @@ -5727,6 +5727,7 @@ __metadata: "@rollup/plugin-json": ^4.1.0 "@rollup/plugin-node-resolve": ^13.0.0 "@rollup/plugin-replace": ^2.4.2 + "@types/node": ^16.7.13 "@typescript-eslint/eslint-plugin": ^4.18.0 "@typescript-eslint/parser": ^4.18.0 babel-plugin-transform-charcodes: ^0.2.0