Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8218055

Browse files
authored
fix(utils): support immutable arrays in ReportFixFunction (typescript-eslint#3830)
1 parent e59a17c commit 8218055

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

packages/eslint-plugin/src/rules/no-explicit-any.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import {
2-
TSESTree,
32
AST_NODE_TYPES,
3+
TSESLint,
4+
TSESTree,
45
} from '@typescript-eslint/experimental-utils';
56
import * as util from '../util';
6-
import { TSESLint } from '@typescript-eslint/experimental-utils';
77

88
export type Options = [
99
{
@@ -199,8 +199,8 @@ export default util.createRule<Options, MessageIds>({
199199
};
200200

201201
if (fixToUnknown) {
202-
fixOrSuggest.fix = (fixer =>
203-
fixer.replaceText(node, 'unknown')) as TSESLint.ReportFixFunction;
202+
fixOrSuggest.fix = (fixer): TSESLint.RuleFix =>
203+
fixer.replaceText(node, 'unknown');
204204
}
205205

206206
context.report({

packages/eslint-plugin/src/rules/prefer-enum-initializers.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import { TSESTree } from '@typescript-eslint/experimental-utils';
1+
import { TSESLint, TSESTree } from '@typescript-eslint/experimental-utils';
22
import * as util from '../util';
3-
import { TSESLint } from '@typescript-eslint/experimental-utils';
43

54
type MessageIds = 'defineInitializer' | 'defineInitializerSuggestion';
65

packages/experimental-utils/src/ts-eslint/Rule.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ interface RuleFixer {
114114

115115
type ReportFixFunction = (
116116
fixer: RuleFixer,
117-
) => null | RuleFix | RuleFix[] | IterableIterator<RuleFix>;
117+
) => null | RuleFix | readonly RuleFix[] | IterableIterator<RuleFix>;
118118
type ReportSuggestionArray<TMessageIds extends string> =
119119
ReportDescriptorBase<TMessageIds>[];
120120

0 commit comments

Comments
 (0)