-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Regression in 7.17 through latest: “Cannot read property 'type' of undefined” at getKeyValue #2570
Comments
Thanks for the simple repro! |
Thank you for the quick patch! This fixes my repro, but doesn’t fix a // @flow
import {Component} from "react";
type LinkProps = $ReadOnly<{
...React$ElementConfig<"a">,
...{|+to: string|} | {|+href: string|},
+styles?: $ReadOnlyArray<
Object | false | null | void
> /* Aphrodite styles, as passed to `css` */,
}>;
class Link extends Component<LinkProps> {} This still has the same error message after updating the dependency on diff --git a/lib/util/ast.js b/lib/util/ast.js
index 731a2733..867560f3 100644
--- a/lib/util/ast.js
+++ b/lib/util/ast.js
@@ -171,6 +171,9 @@ function getKeyValue(context, node) {
if (node.type === 'ObjectTypeAnnotation') {
return;
}
+ if (node.type === 'UnionTypeAnnotation') {
+ return;
+ }
const key = node.key || node.argument;
return key.type === 'Identifier' ? key.name : key.value;
} …but this smells like could be more missing cases—intersection type Does it make sense to re-open this, or should I file a new issue? |
There's probably lots of missing cases :-) a new issue (or even better, a new PR) covering as many cases as you can think of would be great! |
@wchargin ping :-) |
@ljharb this issue still persists with I believe #2570 (comment) still applies as detailed enough to be an issue on it's own :] |
Preparing for release #1679 Note: due to a regression, not upgrading eslint-plugin-react See jsx-eslint/eslint-plugin-react#2570
Preparing for release #1679 Note: due to a regression, not upgrading eslint-plugin-react See jsx-eslint/eslint-plugin-react#2570 Also updated package.json to latest semver in-range versions. Note, this changes all packages (other than eslint-plugin-react) to ^x.x.x format.
Preparing for release #1679 Note: due to a regression, not upgrading eslint-plugin-react See jsx-eslint/eslint-plugin-react#2570 Also updated package.json to latest semver in-range versions. Note, this changes all packages (other than eslint-plugin-react) to ^x.x.x format.
Preparing for release #1679 Note: due to a regression, not upgrading eslint-plugin-react See jsx-eslint/eslint-plugin-react#2570 Also updated package.json to latest semver in-range versions. Note, this changes all packages (other than eslint-plugin-react) to ^x.x.x format.
Repro code:
Stack trace:
Config:
package.json
:yarn.lock
:https://gist.github.com/wchargin/141116df4ff3d1ef2da77b75b5fad51e#file-yarn-lock
Self-contained repro repository (warning: runs code from the internet):
Versions tested:
Original code from which repro was created for context, and to answer
any “why would anyone do that?” questions:
https://github.com/sourcecred/sourcecred/blob/8c47dd1c14ed8c7117f3707a52c481b753d18138/src/webutil/Link.js#L24-L31
The text was updated successfully, but these errors were encountered: