Skip to content

Commit 5a425ff

Browse files
committed
add newly valid test
1 parent 3c288cc commit 5a425ff

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

packages/eslint-plugin/src/rules/no-redundant-type-constituents.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ import {
66
arrayGroupByToMap,
77
createRule,
88
getParserServices,
9-
isFunction,
10-
isFunctionType,
9+
isFunctionOrFunctionType,
1110
isTypeAnyType,
1211
isTypeBigIntLiteralType,
1312
isTypeNeverType,
@@ -171,7 +170,7 @@ function describeLiteralTypeNode(typeNode: TSESTree.TypeNode): string {
171170
function isNodeInsideReturnType(node: TSESTree.TSUnionType): boolean {
172171
return !!(
173172
node.parent.type === AST_NODE_TYPES.TSTypeAnnotation &&
174-
(isFunctionType(node.parent.parent) || isFunction(node.parent.parent))
173+
isFunctionOrFunctionType(node.parent.parent)
175174
);
176175
}
177176

packages/eslint-plugin/tests/rules/no-redundant-type-constituents.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ ruleTester.run('no-redundant-type-constituents', rule, {
165165
type T = 'a' | 1 | 'b';
166166
type U = T & string;
167167
`,
168+
"declare function fn(): never | 'foo';",
168169
],
169170

170171
invalid: [

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy