1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
|
Description: some tsc workarounds
Author: Yadd <yadd@debian.org>
Forwarded: not-needed
Last-Update: 2025-10-28
--- a/projects/patch/src/plugin/plugin-creator.ts
+++ b/projects/patch/src/plugin/plugin-creator.ts
@@ -63,6 +63,7 @@
const { addDiagnostic, removeDiagnostic, diagnostics } = diagnosticExtrasFactory(program);
pluginFactoryResult = (factory as ProgramPattern)(program, cleanConfig, {
+// @ts-ignore
ts: tsp.getTsInstance(),
addDiagnostic,
removeDiagnostic,
--- a/projects/patch/src/ts/create-program.ts
+++ b/projects/patch/src/ts/create-program.ts
@@ -93,13 +93,17 @@
const pluginCreator = new PluginCreator(plugins, { resolveBaseDir: projectConfig.projectDir ?? process.cwd() });
/* Handle JSDoc parsing in v5.3+ */
+// @ts-ignore
if (tsp.currentLibrary === 'tsc' && tsShim.JSDocParsingMode && pluginCreator.needsTscJsDocParsing) {
+// @ts-ignore
host!.jsDocParsingMode = tsShim.JSDocParsingMode.ParseAll;
}
/* Invoke TS createProgram */
let program: tsShim.Program & { originalEmit?: tsShim.Program['emit'] } = createOpts ?
+// @ts-ignore
tsShim.originalCreateProgram(createOpts) :
+// @ts-ignore
tsShim.originalCreateProgram(rootNames, options, host, oldProgram, configFileParsingDiagnostics);
/* Prevent recursion in Program transformers */
@@ -110,6 +114,7 @@
if (activeProgramTransformers.has(transformerKey)) continue;
activeProgramTransformers.add(transformerKey);
+// @ts-ignore
const newProgram: any = programTransformer(program, host, config, { ts: tsp.getTsInstance() });
if (typeof newProgram?.['emit'] === 'function') program = newProgram;
--- a/projects/patch/src/ts/shim.ts
+++ b/projects/patch/src/ts/shim.ts
@@ -38,6 +38,7 @@
export type TransformerFactory<T extends Node> = import('typescript').TransformerFactory<T>;
export type Bundle = import('typescript').Bundle;
export type Path = import('typescript').Path;
+// @ts-ignore
export type JSDocParsingMode = import('typescript').JSDocParsingMode;
}
}
--- a/projects/patch/src/types/plugin-types.ts
+++ b/projects/patch/src/types/plugin-types.ts
@@ -27,6 +27,7 @@
}
export type DiagnosticMap = WeakMap<ts.Program, ts.Diagnostic[]>;
export type TransformerExtras = {
+// @ts-ignore
ts: typeof ts;
library: string;
addDiagnostic: (diag: ts.Diagnostic) => number;
@@ -34,6 +35,7 @@
diagnostics: readonly ts.Diagnostic[];
};
export type ProgramTransformerExtras = {
+// @ts-ignore
ts: typeof ts;
};
export type ProgramTransformer = (program: ts.Program, host: ts.CompilerHost | undefined, config: PluginConfig, extras: ProgramTransformerExtras) => ts.Program;
--- a/projects/patch/src/types/typescript.ts
+++ b/projects/patch/src/types/typescript.ts
@@ -7,5 +7,7 @@
/** @internal */
const createProgram: typeof import('typescript').createProgram;
+// @ts-ignore
+// @ts-ignore
export const originalCreateProgram: typeof ts.createProgram;
}
|