-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Typescript false positive "missing in props validation" on interfaces #2719
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Same for me. This broke when upgrading from 7.20.0 to 7.20.1+ (ESLint 7.5.0) |
Same here, rolling back to 7.20.0 resolved the issue for now, seems the .1 patch broke this. |
Appears to be fixed in 7.20.4. |
…ript props interface extension and TSTypeAliasDeclaration Fixes jsx-eslint#2654. Fixes jsx-eslint#2719. Fixes jsx-eslint#2703.
…ript props interface extension and TSTypeAliasDeclaration Fixes jsx-eslint#2654. Fixes jsx-eslint#2719. Fixes jsx-eslint#2703.
…ript props interface extension and TSTypeAliasDeclaration Fixes jsx-eslint#2654. Fixes jsx-eslint#2719. Fixes jsx-eslint#2703.
…ypescript props interface extension and TSTypeAliasDeclaration Fixes jsx-eslint#2654. Fixes jsx-eslint#2719. Fixes jsx-eslint#2703. Co-authored-by: Hank Chen <[email protected]> Co-authored-by: Jordan Harband <[email protected]>
I'm unfortunately still seeing this in certain scenarios. Right now I'm seeing the issue with an example like so: // `SelectableFileCardProps` and `DNDMovableToBoardItemProps` are interfaces in another file imported in here
// `SelectableFileCardProps` extends off of an another imported file in it's own file
interface DragDroppableFileShellProps extends
SelectableFileCardProps, Pick<DNDMovableToBoardItemProps, 'onDragStart'>
{
children: React.ReactNode;
} |
@kylemh cross-file static analysis is not something that's done in most eslint plugins, and certainly not in this one; unless the TS eslint parser provides that information, it can't work (and i'd expect if it did provide that information, it would already work) |
Hmmm... Is there something I can do to get cross-file static analysis working or should I simply disable this rule? |
The TypeScript eslint parser could certainly be updated to provide this information. I'd start by making test cases here, confirm that they fail, try to figure out where in the AST nodes the information is missing, and then file an issue/PR on the TS eslint parser. |
When creating a type with interface...extends the props from the type that is being extended are ignored.
The following for example throws
'style' is missing in props validation eslint(react/prop-types)
:This however works perfectly:
The text was updated successfully, but these errors were encountered: