Skip to content

Commit

Permalink
Fix updateShapeSignature break
Browse files Browse the repository at this point in the history
  • Loading branch information
dmichon-msft committed Jan 2, 2024
1 parent 2c8bed2 commit 4d77148
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@rushstack/heft-typescript-plugin",
"comment": "Fix break in watch mode during updateShapeSignature call.",
"type": "patch"
}
],
"packageName": "@rushstack/heft-typescript-plugin"
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ export function configureProgramForMultiEmit(
// Attach the originals to the Program instance to avoid modifying the same Program twice.
// Don't use WeakMap because this Program could theoretically get a { ... } applied to it.
[INNER_GET_COMPILER_OPTIONS_SYMBOL]?: TTypescript.Program['getCompilerOptions'];
[INNER_EMIT_SYMBOL]?: TTypescript.Program['emit'];
[INNER_EMIT_SYMBOL]?: // https://github.com/microsoft/TypeScript/blob/88cb76d314a93937ce8d9543114ccbad993be6d1/src/compiler/program.ts#L2697-L2698
// There is a "forceDtsEmit" parameter that is not on the published types.
(...args: [...Parameters<TTypescript.Program['emit']>, boolean | undefined]) => TTypescript.EmitResult;
}

const program: IProgramWithMultiEmit = innerProgram;
Expand Down Expand Up @@ -118,15 +120,17 @@ export function configureProgramForMultiEmit(
writeFile?: TTypescript.WriteFileCallback,
cancellationToken?: TTypescript.CancellationToken,
emitOnlyDtsFiles?: boolean,
customTransformers?: TTypescript.CustomTransformers
customTransformers?: TTypescript.CustomTransformers,
forceDtsEmit?: boolean
) => {
if (emitOnlyDtsFiles) {
return program[INNER_EMIT_SYMBOL]!(
targetSourceFile,
writeFile,
cancellationToken,
emitOnlyDtsFiles,
customTransformers
customTransformers,
forceDtsEmit
);
}

Expand All @@ -151,7 +155,8 @@ export function configureProgramForMultiEmit(
writeFile && wrapWriteFile(writeFile, moduleKindToEmit.jsExtensionOverride),
cancellationToken,
emitOnlyDtsFiles,
customTransformers
customTransformers,
forceDtsEmit
);

emitSkipped = emitSkipped || flavorResult.emitSkipped;
Expand Down

0 comments on commit 4d77148

Please sign in to comment.