From 7daa4643e6c00a5d4a5b74d6f41fb4bd4dcbe97a Mon Sep 17 00:00:00 2001 From: DavidR95 Date: Tue, 24 Dec 2024 20:27:03 +0000 Subject: [PATCH] Use const assertion for flat config When using the flat config in a typechecked ESLint file (with `exactOptionalPropertyTypes: true`), a type error is reported because the generated type for `flat/recommended` is a union, where one element in the union contains `files?: undefined`. `files` can be omitted, but it cannot be explicitly `undefined``. This uses a const assertion so that, in the inferred type, `files` is correctly omitted. --- src/configs/flat/recommended.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/configs/flat/recommended.ts b/src/configs/flat/recommended.ts index acdcfa0e..b177beb2 100644 --- a/src/configs/flat/recommended.ts +++ b/src/configs/flat/recommended.ts @@ -30,6 +30,6 @@ const recommended = [ }, rules } -] satisfies Linter.FlatConfig[]; +] as const satisfies Linter.FlatConfig[]; export = recommended;