Typescript Unknown Jsx Expression

Fix TypeScript error "Type 'unknown' is not assignable to type ReactNode" when using Record<string, unknown> values directly in JSX && short-circuit expressions. Use when: (1) JSX expression {someObj.field && <Component />} fails with TS2322, (2) Reading from a JSON or untyped object via bracket notation in JSX conditionals, (3) Values typed as unknown appear in JSX even when wrapped in String() or guarded with truthiness checks. Fix: use !! to coerce to boolean before the && operator.

yorch f9818e2 2 files · 4.2 KB Updated

File contents

yorch/claude-skills/tree/main/skills/typescript-unknown-jsx-expression commit f9818e2a20

Frequently asked questions

npx skillmds add yorch/typescript-unknown-jsx-expression