From 9f609de3b02e298c4e0a9fdde6a26916385a3897 Mon Sep 17 00:00:00 2001 From: Julian Kobrynski Date: Thu, 9 May 2024 16:12:33 +0200 Subject: [PATCH] add more details to the satisfies operator section --- contributingGuides/STYLE.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/contributingGuides/STYLE.md b/contributingGuides/STYLE.md index 9c7073095e8a..22b1dea61bae 100644 --- a/contributingGuides/STYLE.md +++ b/contributingGuides/STYLE.md @@ -406,9 +406,11 @@ const sizingStyles = { mw100: { maxWidth: '100%', }, -} satisfies Record; +} as const satisfies Record; ``` +The example above results in the most narrow type possible, also the values are `readonly`. There are some cases in which that is not desired (e.g. the variable can be modified), if so `as const` should be omitted. + ### Type imports/exports Always use the `type` keyword when importing/exporting types