testImportGenericCallsBetweenFiles
A constant made by calling, with type arguments, a function another of the files imported declares (as Effect's
withGroup = dual<…>(…) is, dual from ./Function.ts) imports: what the call is (a table? by its role) is asked
of that file's definition, not refused as an import of a local file.
import { okIn, tempDir } from "#codebase/tcmts/cli/test/e2e/harness"; import assert from "node:assert/strict"; import fs from "node:fs"; import path from "node:path"; export const testImportGenericCallsBetweenFiles = () => { const dir = tempDir("import generic"); const tcm = (...args: string[]) => okIn(dir, ...args); const project = tempDir("import generic project"); fs.writeFileSync( path.join(project, "tsconfig.json"), JSON.stringify({ compilerOptions: { strict: true, allowImportingTsExtensions: true, noEmit: true }, }), ); fs.writeFileSync( path.join(project, "Function.ts"), "export const dual = <F>(arity: number, f: F): F => f;\n", ); fs.writeFileSync( path.join(project, "Console.ts"), `import { dual } from "./Function.ts"\nexport const sum = dual<(a: number, b: number) => number>(2, (a, b) => a + b);\n`, ); tcm("init"); assert.match(tcm("import", project, "--into", "effect"), /\+ new 2/); assert.match(tcm("view", "effect.Console.sum"), /dual<\(a: number, b: number\) => number>/); }