TypeScript: property does not exist on type IntrinsicAttributes in a React component
Property 'XXX' does not exist on type 'IntrinsicAttributes & ...'Short answer
TypeScript checks the props you write in JSX against the component's props type. The error means you passed a prop that type does not list. Add the prop to the component's props interface, fix a misspelled name, or add an index signature if the component really accepts arbitrary extra props.
Fix it fast
1Find out which cause you have
Open the component's definition and read its props type. Compare it with the props you pass at the place the error points to.
npx tsc --noEmit2Match what you see, then jump to its fix
- 1
The error names a prop that you pass on purpose.The prop is not declared in the component's props typeFix - 2
TypeScript adds Did you mean ...? to the message, or another prop in the type looks like the one you wrote.The prop name is misspelled or was renamedFix - 3
Many different names are passed through, and listing each one is not realistic.The component really takes extra props that are not known in advanceFix
- 1
What does the error look like?
Property 'XXX' does not exist on type 'IntrinsicAttributes & ...'Object literal may only specify known properties
Cause 1 of 3
The prop is not declared in the component's props type
1Check
Look at the interface or type used for the component's parameter.
grep -n "interface .*Props\|type .*Props" src/components/MyButton.tsx2Fix
Add the prop to the interface, and use that interface on the function's parameter.
interface MyButtonProps {
title: string;
disabled: boolean;
}
function MyButton({ title, disabled }: MyButtonProps) {
return <button disabled={disabled}>{title}</button>;
}3Verify
Run the type check. The error at the call site should be gone.
npx tsc --noEmitConfirmed by react.dev
Cause 2 of 3
The prop name is misspelled or was renamed
1Check
TypeScript treats object literals with unknown properties as a probable bug. Compare spelling and case with the declared names.
grep -rn "<MyButton" src/2Fix
Use the declared name at the call site; rename the declaration only if the new name is the better one, and then update every user.
// declared: title
<MyButton title="Save" disabled={false} />3Verify
Run the type check again.
npx tsc --noEmitConfirmed by typescriptlang.org
Cause 3 of 3
The component really takes extra props that are not known in advance
1Check
Confirm that the component forwards them somewhere useful, and not just ignores them.
grep -n "\.\.\.rest\|\.\.\.props" src/components/MyButton.tsx2Fix
Add a string index signature to the props type. Known properties must still match their declared types.
interface MyButtonProps {
title: string;
[propName: string]: unknown;
}3Verify
Run the type check. Unknown names pass, a wrong type for title still fails.
npx tsc --noEmitConfirmed by typescriptlang.org
How do I stop it coming back?
- Declare a named props interface for every component, and export it next to the component.
- Run tsc --noEmit in CI so a prop change breaks the build at the call site.
- Use your editor's rename command when changing a prop name, so all usages change together.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine built on the same technologies:
- TaxiDexMy own multi-tenant taxi dispatch SaaS: API, dispatcher portal, driver and passenger apps, and the servers underneath.
- QistLockA NestJS and React SaaS driving an Android Device Owner agent that locks financed phones when payments lapse.
- TaskvareA task and project-management suite: React on the web, Flutter on mobile, TypeScript underneath.
Related fixes
Web apps
ESLint says it cannot resolve a path to a module that does exist
Unable to resolve path to module 'react'. import/no-unresolved
import/no-unresolved fails when eslint-plugin-import cannot find the file or package on disk with its resolver.
4 causes, each with a fixWeb apps
Upgrading to Next.js 16: middleware becomes proxy, and the other things that break
Missing Required default.js for Parallel Route
Next.js 16 renames middleware.ts to proxy.ts and its exported function to proxy.
6 causes, each with a fixWeb apps
TypeScript 2695: left side of comma operator is unused in React code
Left side of comma operator is unused and has no side effects.ts(2695)
In JavaScript a comma between expressions evaluates all of them and keeps only the last, so the left ones are thrown away.
3 causes, each with a fixWeb apps
TypeScript says a JavaScript module implicitly has an any type
Could not find a declaration file for module 'react-materialize'. 'path/to/module-name.js' implicitly has an 'any' type.
TypeScript found the JavaScript file but no types for it, and noImplicitAny turns that into an error.
2 causes, each with a fixWeb apps
TypeScript says a function lacks an ending return statement
A function with a declared return type, such as Promise<string>, shows the red line under the type
TypeScript found a way for your function to reach its closing brace without returning a value, while the declared return type does not allow undefined.
4 causes, each with a fixWeb apps
tsconfig rejects allowImportingTsExtensions
An error that allowImportingTsExtensions needs noEmit or emitDeclarationOnly
allowImportingTsExtensions lets files import each other with .ts or .tsx extensions, and TypeScript only allows it together with noEmit or emitDeclarationOnly.
2 causes, each with a fix