-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Description
Bug
When jsxImportSource is set to "smithers-orchestrator", TypeScript rejects the key prop on mapped Smithers components:
Property 'key' does not exist on type 'SequenceProps'
Intrinsic elements (like <div>) can also lose type information under this setup.
Root cause
smithers-orchestrator/jsx-runtime re-exports runtime functions (jsx, jsxs, Fragment, jsxDEV) but does not export a JSX namespace. TypeScript expects jsxImportSource modules to provide JSX.IntrinsicAttributes (which includes key), JSX.IntrinsicElements, etc. Without them, key/ref are not merged and are checked directly against component props.
Minimal Reproducible Example
package.json
{
"dependencies": {
"smithers-orchestrator": "latest",
"react": "^19.0.0",
"@types/react": "^19.0.0",
"typescript": "^5.8.0"
}
}tsconfig.json
{
"compilerOptions": {
"strict": true,
"target": "ESNext",
"module": "ESNext",
"moduleResolution": "bundler",
"jsx": "react-jsx",
"jsxImportSource": "smithers-orchestrator",
"noEmit": true,
"skipLibCheck": true
},
"include": ["src"]
}src/bug.tsx
import type { ReactNode } from "react";
type SequenceProps = { skipIf?: boolean; children?: ReactNode };
declare function Sequence(props: SequenceProps): ReactNode;
const items = [1, 2, 3];
// ERROR: Property 'key' does not exist on type 'SequenceProps'
export const demo = (
<>
{items.map((n) => (
<Sequence key={`s-${n}`} skipIf={false}>
<div>{n}</div>
</Sequence>
))}
</>
);Reproduce:
npm install && npx tsc --noEmitExpected: compiles cleanly (as it does with jsxImportSource: "react")
Actual:
src/bug.tsx: error TS2322: Type '{ key: string; skipIf: false; children: Element; }'
is not assignable to type 'SequenceProps'.
Property 'key' does not exist on type 'SequenceProps'.
Related
PR #80 addresses this.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels