[5];',
+ errors: [
+ {
+ messageId: 'unexpectedArrayTypeAssertion',
+ suggestions: [
+ {
+ data: { cast: 'Foo' },
+ messageId: 'replaceArrayTypeAssertionWithAnnotation',
+ output: 'const foo: Foo = [5];',
+ },
+ {
+ data: { cast: 'Foo' },
+ messageId: 'replaceArrayTypeAssertionWithSatisfies',
+ output: 'const foo = [5] satisfies Foo;',
+ },
+ ],
+ },
+ ],
+ options: [
+ {
+ arrayLiteralTypeAssertions: 'allow-as-parameter',
+ assertionStyle: 'angle-bracket',
+ },
+ ],
+ },
],
});
diff --git a/packages/eslint-plugin/tests/schema-snapshots/consistent-type-assertions.shot b/packages/eslint-plugin/tests/schema-snapshots/consistent-type-assertions.shot
index 7845d5b791bb..a999506e695e 100644
--- a/packages/eslint-plugin/tests/schema-snapshots/consistent-type-assertions.shot
+++ b/packages/eslint-plugin/tests/schema-snapshots/consistent-type-assertions.shot
@@ -22,6 +22,11 @@ exports[`Rule schemas should be convertible to TS types for documentation purpos
{
"additionalProperties": false,
"properties": {
+ "arrayLiteralTypeAssertions": {
+ "description": "Whether to always prefer type declarations for array literals used as variable initializers, rather than type assertions.",
+ "enum": ["allow", "allow-as-parameter", "never"],
+ "type": "string"
+ },
"assertionStyle": {
"description": "The expected assertion style to enforce.",
"enum": ["angle-bracket", "as"],
@@ -49,6 +54,12 @@ type Options = [
'never';
}
| {
+ /** Whether to always prefer type declarations for array literals used as variable initializers, rather than type assertions. */
+ arrayLiteralTypeAssertions?:
+ | 'allow-as-parameter'
+ | 'never'
+ /** Whether to always prefer type declarations for array literals used as variable initializers, rather than type assertions. */
+ | 'allow';
/** The expected assertion style to enforce. */
assertionStyle?:
| 'as'
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