From f2c4c011707a084f34a7270509169756938c54df Mon Sep 17 00:00:00 2001 From: webwarrior-ws Date: Wed, 15 Apr 2026 15:12:30 +0200 Subject: [PATCH 1/2] docs/WorkflowGuidelines.md: add rule about typeof Added a rule about typeof operator in TypeScript. --- docs/WorkflowGuidelines.md | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/docs/WorkflowGuidelines.md b/docs/WorkflowGuidelines.md index a114a2384..54756d9e8 100644 --- a/docs/WorkflowGuidelines.md +++ b/docs/WorkflowGuidelines.md @@ -306,6 +306,37 @@ ```typescript const inputs = Array.from(tableCell.children); ``` + + * Avoid using `typeof` operator in TypeScript, prefer using explicit types. An exception to this rule is when type in question is a big type nested inside other type. + + Example (with bad practice): + ```typescript + export const PpqPlugin: Plugin = async ({ client }) => { + return { + async config(config) { + let provider: typeof config.provider; + provider = {}; + config.provider = provider; + } + } + } + ``` + + Improved code: + ```typescript + // import relevant type + import type { ProviderConfig } from "@opencode-ai/sdk"; + + export const PpqPlugin: Plugin = async ({ client }) => { + return { + async config(config) { + let provider: Record; + provider = {}; + config.provider = provider; + } + } + } + ``` * If you want to contribute a script, do not use PowerShell or Bash, but an F# script. The reason to not use PowerShell is a personal preference From 636e01ea59b0e8fc35b4e4293e134fbbce81d0ec Mon Sep 17 00:00:00 2001 From: webwarrior-ws Date: Thu, 16 Apr 2026 10:24:27 +0200 Subject: [PATCH 2/2] WIP --- docs/WorkflowGuidelines.md | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/docs/WorkflowGuidelines.md b/docs/WorkflowGuidelines.md index 54756d9e8..cff4ca051 100644 --- a/docs/WorkflowGuidelines.md +++ b/docs/WorkflowGuidelines.md @@ -314,9 +314,8 @@ export const PpqPlugin: Plugin = async ({ client }) => { return { async config(config) { - let provider: typeof config.provider; - provider = {}; - config.provider = provider; + const provider: typeof config.provider = config.provider; + // ... } } } @@ -330,9 +329,8 @@ export const PpqPlugin: Plugin = async ({ client }) => { return { async config(config) { - let provider: Record; - provider = {}; - config.provider = provider; + const provider: Record = config.provider; + // ... } } }