mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Support Flow as expressions in ESLint rules (#27590)
Support Flow `as` expressions in ESLint rules, e.g. `<expr> as <type>`.
This is the same syntax as TypeScript as expressions. I just looked for
any place referencing `TSAsExpression` (the TS node) or
`TypeCastExpression` (the previous Flow syntax) and added a case for
`AsExpression` as well.
DiffTrain build for [6bfc0e032a](https://github.com/facebook/react/commit/6bfc0e032acc7e5ad6da2a09f3c4f47f3321da2c)
This commit is contained in:
@@ -1 +1 @@
|
||||
d947c2f1100dfd006fd91c6e9ed84d42ca7ab088
|
||||
6bfc0e032acc7e5ad6da2a09f3c4f47f3321da2c
|
||||
|
||||
@@ -960,7 +960,7 @@ var ExhaustiveDeps = {
|
||||
return false;
|
||||
}
|
||||
|
||||
while (init.type === 'TSAsExpression') {
|
||||
while (init.type === 'TSAsExpression' || init.type === 'AsExpression') {
|
||||
init = init.expression;
|
||||
} // Detect primitive constants
|
||||
// const foo = 42
|
||||
@@ -2232,8 +2232,7 @@ function getConstructionExpressionType(node) {
|
||||
return null;
|
||||
|
||||
case 'TypeCastExpression':
|
||||
return getConstructionExpressionType(node.expression);
|
||||
|
||||
case 'AsExpression':
|
||||
case 'TSAsExpression':
|
||||
return getConstructionExpressionType(node.expression);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user