Surface noErrorTruncation option

This commit is contained in:
gcnew
2016-08-06 01:10:02 +03:00
parent 269b828538
commit 46f5e5fad1
5 changed files with 67 additions and 0 deletions

View File

@@ -126,6 +126,11 @@ namespace ts {
type: "boolean",
description: Diagnostics.Do_not_emit_outputs_if_any_errors_were_reported,
},
{
name: "noErrorTruncation",
type: "boolean",
description: Diagnostics.Do_not_truncate_verbose_types,
},
{
name: "noImplicitAny",
type: "boolean",

View File

@@ -2828,6 +2828,10 @@
"category": "Message",
"code": 6137
},
"Do not truncate verbose types.": {
"category": "Message",
"code": 6138
},
"Variable '{0}' implicitly has an '{1}' type.": {
"category": "Error",
"code": 7005

View File

@@ -0,0 +1,22 @@
tests/cases/compiler/noErrorTruncation.ts(10,7): error TS2322: Type 'number' is not assignable to type '{ someLongOptionA: string; } | { someLongOptionB: string; } | { someLongOptionC: string; } | { someLongOptionD: string; } | { someLongOptionE: string; } | { someLongOptionF: string; }'.
==== tests/cases/compiler/noErrorTruncation.ts (1 errors) ====
// @noErrorTruncation
type SomeLongOptionA = { someLongOptionA: string }
type SomeLongOptionB = { someLongOptionB: string }
type SomeLongOptionC = { someLongOptionC: string }
type SomeLongOptionD = { someLongOptionD: string }
type SomeLongOptionE = { someLongOptionE: string }
type SomeLongOptionF = { someLongOptionF: string }
const x: SomeLongOptionA
~
!!! error TS2322: Type 'number' is not assignable to type '{ someLongOptionA: string; } | { someLongOptionB: string; } | { someLongOptionC: string; } | { someLongOptionD: string; } | { someLongOptionE: string; } | { someLongOptionF: string; }'.
| SomeLongOptionB
| SomeLongOptionC
| SomeLongOptionD
| SomeLongOptionE
| SomeLongOptionF = 42;

View File

@@ -0,0 +1,21 @@
//// [noErrorTruncation.ts]
// @noErrorTruncation
type SomeLongOptionA = { someLongOptionA: string }
type SomeLongOptionB = { someLongOptionB: string }
type SomeLongOptionC = { someLongOptionC: string }
type SomeLongOptionD = { someLongOptionD: string }
type SomeLongOptionE = { someLongOptionE: string }
type SomeLongOptionF = { someLongOptionF: string }
const x: SomeLongOptionA
| SomeLongOptionB
| SomeLongOptionC
| SomeLongOptionD
| SomeLongOptionE
| SomeLongOptionF = 42;
//// [noErrorTruncation.js]
// @noErrorTruncation
var x = 42;

View File

@@ -0,0 +1,15 @@
// @noErrorTruncation
type SomeLongOptionA = { someLongOptionA: string }
type SomeLongOptionB = { someLongOptionB: string }
type SomeLongOptionC = { someLongOptionC: string }
type SomeLongOptionD = { someLongOptionD: string }
type SomeLongOptionE = { someLongOptionE: string }
type SomeLongOptionF = { someLongOptionF: string }
const x: SomeLongOptionA
| SomeLongOptionB
| SomeLongOptionC
| SomeLongOptionD
| SomeLongOptionE
| SomeLongOptionF = 42;