Skip to content

Commit 7ab77a2

Browse files
authored
fix: correct breaking deprecation of FlatConfig type (#19826)
fix: correct deprecation of FlatConfig type
1 parent a2f888d commit 7ab77a2

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

‎lib/types/index.d.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1831,7 +1831,7 @@ export namespace Linter {
18311831
}
18321832

18331833
/** @deprecated Use `Config` instead of `FlatConfig` */
1834-
type FlatConfig = Config;
1834+
type FlatConfig<Rules extends RulesRecord = RulesRecord> = Config<Rules>;
18351835

18361836
type GlobalConf =
18371837
| boolean

‎tests/lib/types/types.test.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2135,6 +2135,12 @@ let flatConfig!: Linter.FlatConfig;
21352135
config = flatConfig;
21362136
flatConfig = config;
21372137

2138+
let configWithRules!: Linter.Config<ESLintRules>;
2139+
let flatConfigWithRules!: Linter.FlatConfig<ESLintRules>;
2140+
configWithRules = flatConfigWithRules;
2141+
flatConfigWithRules = configWithRules;
2142+
flatConfigWithRules.rules; // $ExpectType Partial<ESLintRules> | undefined
2143+
21382144
// #endregion Config
21392145

21402146
// #region Plugins

0 commit comments

Comments
 (0)