|
679 | 679 | }, |
680 | 680 | "additionalProperties": false |
681 | 681 | }, |
| 682 | + "ArrayLiteralTypeAssertions": { |
| 683 | + "oneOf": [ |
| 684 | + { |
| 685 | + "description": "Allow type assertions on array literals.\n\nExamples of **correct** code with this option:\n```ts\nconst x = [1, 2] as number[];\nconst x = ['a'] as Array<string>;\n```", |
| 686 | + "type": "string", |
| 687 | + "enum": [ |
| 688 | + "allow" |
| 689 | + ], |
| 690 | + "markdownDescription": "Allow type assertions on array literals.\n\nExamples of **correct** code with this option:\n```ts\nconst x = [1, 2] as number[];\nconst x = ['a'] as Array<string>;\n```" |
| 691 | + }, |
| 692 | + { |
| 693 | + "description": "Allow type assertions on array literals only when used as a function parameter,\n`throw` target, or default value.\n\nExamples of **incorrect** code with this option:\n```ts\nconst x = [1, 2] as Foo;\nconst foo = () => [5] as Foo;\n```\n\nExamples of **correct** code with this option:\n```ts\nprint([5] as Foo);\nthrow [1, 2] as Bar;\nfunction f(x = [5] as Foo.Bar) {}\n```", |
| 694 | + "type": "string", |
| 695 | + "enum": [ |
| 696 | + "allow-as-parameter" |
| 697 | + ], |
| 698 | + "markdownDescription": "Allow type assertions on array literals only when used as a function parameter,\n`throw` target, or default value.\n\nExamples of **incorrect** code with this option:\n```ts\nconst x = [1, 2] as Foo;\nconst foo = () => [5] as Foo;\n```\n\nExamples of **correct** code with this option:\n```ts\nprint([5] as Foo);\nthrow [1, 2] as Bar;\nfunction f(x = [5] as Foo.Bar) {}\n```" |
| 699 | + }, |
| 700 | + { |
| 701 | + "description": "Disallow type assertions on array literals entirely.\n\nExamples of **incorrect** code with this option:\n```ts\nconst x = [1, 2] as Foo;\nprint([5] as Foo);\n```\n\nExamples of **correct** code with this option:\n```ts\nconst x: Foo = [1, 2];\nconst x = [1, 2] satisfies Foo;\n```", |
| 702 | + "type": "string", |
| 703 | + "enum": [ |
| 704 | + "never" |
| 705 | + ], |
| 706 | + "markdownDescription": "Disallow type assertions on array literals entirely.\n\nExamples of **incorrect** code with this option:\n```ts\nconst x = [1, 2] as Foo;\nprint([5] as Foo);\n```\n\nExamples of **correct** code with this option:\n```ts\nconst x: Foo = [1, 2];\nconst x = [1, 2] satisfies Foo;\n```" |
| 707 | + } |
| 708 | + ] |
| 709 | + }, |
682 | 710 | "ArrowBodyStyle": { |
683 | 711 | "type": "array", |
684 | 712 | "items": [ |
|
702 | 730 | }, |
703 | 731 | "additionalProperties": false |
704 | 732 | }, |
| 733 | + "AssertionStyle": { |
| 734 | + "oneOf": [ |
| 735 | + { |
| 736 | + "description": "Enforce `as` syntax for type assertions.\n\nExamples of **incorrect** code with this option:\n```ts\nconst value = <Foo>bar;\n```\n\nExamples of **correct** code with this option:\n```ts\nconst value = bar as Foo;\n```", |
| 737 | + "type": "string", |
| 738 | + "enum": [ |
| 739 | + "as" |
| 740 | + ], |
| 741 | + "markdownDescription": "Enforce `as` syntax for type assertions.\n\nExamples of **incorrect** code with this option:\n```ts\nconst value = <Foo>bar;\n```\n\nExamples of **correct** code with this option:\n```ts\nconst value = bar as Foo;\n```" |
| 742 | + }, |
| 743 | + { |
| 744 | + "description": "Enforce angle-bracket syntax for type assertions.\n\nExamples of **incorrect** code with this option:\n```ts\nconst value = bar as Foo;\n```\n\nExamples of **correct** code with this option:\n```ts\nconst value = <Foo>bar;\n```", |
| 745 | + "type": "string", |
| 746 | + "enum": [ |
| 747 | + "angle-bracket" |
| 748 | + ], |
| 749 | + "markdownDescription": "Enforce angle-bracket syntax for type assertions.\n\nExamples of **incorrect** code with this option:\n```ts\nconst value = bar as Foo;\n```\n\nExamples of **correct** code with this option:\n```ts\nconst value = <Foo>bar;\n```" |
| 750 | + }, |
| 751 | + { |
| 752 | + "description": "Disallow type assertions entirely.\n\nExamples of **incorrect** code with this option:\n```ts\nconst value = bar as Foo;\nconst value = <Foo>bar;\n```\n\nExamples of **correct** code with this option:\n```ts\nconst value: Foo = bar;\nconst value = bar satisfies Foo;\n```", |
| 753 | + "type": "string", |
| 754 | + "enum": [ |
| 755 | + "never" |
| 756 | + ], |
| 757 | + "markdownDescription": "Disallow type assertions entirely.\n\nExamples of **incorrect** code with this option:\n```ts\nconst value = bar as Foo;\nconst value = <Foo>bar;\n```\n\nExamples of **correct** code with this option:\n```ts\nconst value: Foo = bar;\nconst value = bar satisfies Foo;\n```" |
| 758 | + } |
| 759 | + ] |
| 760 | + }, |
705 | 761 | "AutocompleteValidConfig": { |
706 | 762 | "type": "object", |
707 | 763 | "properties": { |
|
1267 | 1323 | }, |
1268 | 1324 | "additionalProperties": false |
1269 | 1325 | }, |
| 1326 | + "ConsistentTypeAssertionsConfig": { |
| 1327 | + "type": "object", |
| 1328 | + "properties": { |
| 1329 | + "arrayLiteralTypeAssertions": { |
| 1330 | + "description": "Whether array literal type assertions are allowed, allowed only as parameters, or disallowed.", |
| 1331 | + "allOf": [ |
| 1332 | + { |
| 1333 | + "$ref": "#/definitions/ArrayLiteralTypeAssertions" |
| 1334 | + } |
| 1335 | + ], |
| 1336 | + "markdownDescription": "Whether array literal type assertions are allowed, allowed only as parameters, or disallowed." |
| 1337 | + }, |
| 1338 | + "assertionStyle": { |
| 1339 | + "description": "Which assertion syntax is enforced.", |
| 1340 | + "allOf": [ |
| 1341 | + { |
| 1342 | + "$ref": "#/definitions/AssertionStyle" |
| 1343 | + } |
| 1344 | + ], |
| 1345 | + "markdownDescription": "Which assertion syntax is enforced." |
| 1346 | + }, |
| 1347 | + "objectLiteralTypeAssertions": { |
| 1348 | + "description": "Whether object literal type assertions are allowed, allowed only as parameters, or disallowed.", |
| 1349 | + "allOf": [ |
| 1350 | + { |
| 1351 | + "$ref": "#/definitions/ObjectLiteralTypeAssertions" |
| 1352 | + } |
| 1353 | + ], |
| 1354 | + "markdownDescription": "Whether object literal type assertions are allowed, allowed only as parameters, or disallowed." |
| 1355 | + } |
| 1356 | + }, |
| 1357 | + "additionalProperties": false |
| 1358 | + }, |
1270 | 1359 | "ConsistentTypeDefinitionsConfig": { |
1271 | 1360 | "oneOf": [ |
1272 | 1361 | { |
|
6318 | 6407 | ] |
6319 | 6408 | }, |
6320 | 6409 | "typescript/consistent-type-assertions": { |
6321 | | - "$ref": "#/definitions/DummyRule" |
| 6410 | + "anyOf": [ |
| 6411 | + { |
| 6412 | + "$ref": "#/definitions/AllowWarnDeny" |
| 6413 | + }, |
| 6414 | + { |
| 6415 | + "type": "array", |
| 6416 | + "items": [ |
| 6417 | + { |
| 6418 | + "$ref": "#/definitions/AllowWarnDeny" |
| 6419 | + }, |
| 6420 | + { |
| 6421 | + "$ref": "#/definitions/ConsistentTypeAssertionsConfig" |
| 6422 | + } |
| 6423 | + ], |
| 6424 | + "maxItems": 2, |
| 6425 | + "minItems": 1 |
| 6426 | + } |
| 6427 | + ] |
6322 | 6428 | }, |
6323 | 6429 | "typescript/consistent-type-definitions": { |
6324 | 6430 | "anyOf": [ |
|
13973 | 14079 | } |
13974 | 14080 | ] |
13975 | 14081 | }, |
| 14082 | + "ObjectLiteralTypeAssertions": { |
| 14083 | + "oneOf": [ |
| 14084 | + { |
| 14085 | + "description": "Allow type assertions on object literals.\n\nExamples of **correct** code with this option:\n```ts\nconst x = { a: 1 } as Foo;\nconst x = {} as Foo<int>;\n```", |
| 14086 | + "type": "string", |
| 14087 | + "enum": [ |
| 14088 | + "allow" |
| 14089 | + ], |
| 14090 | + "markdownDescription": "Allow type assertions on object literals.\n\nExamples of **correct** code with this option:\n```ts\nconst x = { a: 1 } as Foo;\nconst x = {} as Foo<int>;\n```" |
| 14091 | + }, |
| 14092 | + { |
| 14093 | + "description": "Allow type assertions on object literals only when used as a function parameter,\n`throw` target, or default value.\n\nExamples of **incorrect** code with this option:\n```ts\nconst x = { a: 1 } as Foo;\nconst x = {} as Foo<int>;\n```\n\nExamples of **correct** code with this option:\n```ts\nprint({ a: 1 } as Foo);\nthrow { bar: 5 } as Foo;\nfunction f(x = {} as Foo) {}\n```", |
| 14094 | + "type": "string", |
| 14095 | + "enum": [ |
| 14096 | + "allow-as-parameter" |
| 14097 | + ], |
| 14098 | + "markdownDescription": "Allow type assertions on object literals only when used as a function parameter,\n`throw` target, or default value.\n\nExamples of **incorrect** code with this option:\n```ts\nconst x = { a: 1 } as Foo;\nconst x = {} as Foo<int>;\n```\n\nExamples of **correct** code with this option:\n```ts\nprint({ a: 1 } as Foo);\nthrow { bar: 5 } as Foo;\nfunction f(x = {} as Foo) {}\n```" |
| 14099 | + }, |
| 14100 | + { |
| 14101 | + "description": "Disallow type assertions on object literals entirely.\n\nExamples of **incorrect** code with this option:\n```ts\nconst x = { a: 1 } as Foo;\nprint({ a: 1 } as Foo);\n```\n\nExamples of **correct** code with this option:\n```ts\nconst x: Foo = { a: 1 };\nconst x = { a: 1 } satisfies Foo;\n```", |
| 14102 | + "type": "string", |
| 14103 | + "enum": [ |
| 14104 | + "never" |
| 14105 | + ], |
| 14106 | + "markdownDescription": "Disallow type assertions on object literals entirely.\n\nExamples of **incorrect** code with this option:\n```ts\nconst x = { a: 1 } as Foo;\nprint({ a: 1 } as Foo);\n```\n\nExamples of **correct** code with this option:\n```ts\nconst x: Foo = { a: 1 };\nconst x = { a: 1 } satisfies Foo;\n```" |
| 14107 | + } |
| 14108 | + ] |
| 14109 | + }, |
13976 | 14110 | "ObjectShorthandOptions": { |
13977 | 14111 | "type": "object", |
13978 | 14112 | "properties": { |
|
0 commit comments