From 9597b5bc76c24b66f3e7b000e1038ad8d6ab3450 Mon Sep 17 00:00:00 2001 From: Eddy Nguyen Date: Fri, 25 Sep 2026 10:18:06 +1000 Subject: [PATCH] [add] fix: return empty string for content under strict mode (#4683) (#10986) * [add] fix: return empty string for content under strict mode (#4683) `content: null` doesn't satisfy `ComplexPluginOutput.content: string` once `strictNullChecks` is on. Core already treats null and '' the same (`result.content || ''`), so the generated output doesn't change. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_016PjJDfAYR1JPdgiQRvvZZy eddeee888:oss:issue-fix * [add] chore: describe output change in changeset (#4683) Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_016PjJDfAYR1JPdgiQRvvZZy --------- Co-authored-by: Claude --- .changeset/quiet-pens-return.md | 5 +++++ packages/plugins/other/add/src/index.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/quiet-pens-return.md diff --git a/.changeset/quiet-pens-return.md b/.changeset/quiet-pens-return.md new file mode 100644 index 00000000000..a938ccaecca --- /dev/null +++ b/.changeset/quiet-pens-return.md @@ -0,0 +1,5 @@ +--- +'@graphql-codegen/add': patch +--- + +The plugin output's `content` is now an empty string (`''`) instead of `null` when `placement` is `prepend` or `append`. This matches the `ComplexPluginOutput` type (`content: string`). Code that calls the plugin directly and checks `content === null` should check for an empty string instead. Generated files are unchanged. diff --git a/packages/plugins/other/add/src/index.ts b/packages/plugins/other/add/src/index.ts index 3f842b47ad5..375f9c0e9bf 100644 --- a/packages/plugins/other/add/src/index.ts +++ b/packages/plugins/other/add/src/index.ts @@ -25,7 +25,7 @@ export const plugin: PluginFunction = async ( } return { - content: null, + content: '', [placement]: Array.isArray(content) ? content : [content], }; };