mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
noErrorTruncation affects semantic diagnostics (#36306)
This commit is contained in:
committed by
Sheetal Nandi
parent
ef5573b266
commit
0276e7f910
@@ -822,6 +822,7 @@ namespace ts {
|
||||
{
|
||||
name: "noErrorTruncation",
|
||||
type: "boolean",
|
||||
affectsSemanticDiagnostics: true,
|
||||
category: Diagnostics.Advanced_Options,
|
||||
description: Diagnostics.Do_not_truncate_error_messages
|
||||
},
|
||||
|
||||
@@ -1164,6 +1164,39 @@ foo().hello`
|
||||
]
|
||||
});
|
||||
|
||||
verifyTscWatch({
|
||||
scenario,
|
||||
subScenario: "updates errors when noErrorTruncation changes",
|
||||
commandLineArgs: ["-w"],
|
||||
sys: () => {
|
||||
const aFile: File = {
|
||||
path: `${projectRoot}/a.ts`,
|
||||
content: `declare var v: {
|
||||
reallyLongPropertyName1: string | number | boolean | object | symbol | bigint;
|
||||
reallyLongPropertyName2: string | number | boolean | object | symbol | bigint;
|
||||
reallyLongPropertyName3: string | number | boolean | object | symbol | bigint;
|
||||
reallyLongPropertyName4: string | number | boolean | object | symbol | bigint;
|
||||
reallyLongPropertyName5: string | number | boolean | object | symbol | bigint;
|
||||
reallyLongPropertyName6: string | number | boolean | object | symbol | bigint;
|
||||
reallyLongPropertyName7: string | number | boolean | object | symbol | bigint;
|
||||
};
|
||||
v === 'foo';`
|
||||
};
|
||||
const config: File = {
|
||||
path: `${projectRoot}/tsconfig.json`,
|
||||
content: JSON.stringify({ compilerOptions: {} })
|
||||
};
|
||||
return createWatchedSystem([aFile, config, libFile], { currentDirectory: projectRoot });
|
||||
},
|
||||
changes: [
|
||||
sys => {
|
||||
sys.writeFile(`${projectRoot}/tsconfig.json`, JSON.stringify({ compilerOptions: { noErrorTruncation: true } }));
|
||||
sys.runQueuedTimeoutCallbacks();
|
||||
return "Enable noErrorTruncation";
|
||||
},
|
||||
]
|
||||
});
|
||||
|
||||
verifyTscWatch({
|
||||
scenario,
|
||||
subScenario: "updates diagnostics and emit when useDefineForClassFields changes",
|
||||
|
||||
+117
@@ -0,0 +1,117 @@
|
||||
/a/lib/tsc.js -w
|
||||
//// [/user/username/projects/myproject/a.ts]
|
||||
declare var v: {
|
||||
reallyLongPropertyName1: string | number | boolean | object | symbol | bigint;
|
||||
reallyLongPropertyName2: string | number | boolean | object | symbol | bigint;
|
||||
reallyLongPropertyName3: string | number | boolean | object | symbol | bigint;
|
||||
reallyLongPropertyName4: string | number | boolean | object | symbol | bigint;
|
||||
reallyLongPropertyName5: string | number | boolean | object | symbol | bigint;
|
||||
reallyLongPropertyName6: string | number | boolean | object | symbol | bigint;
|
||||
reallyLongPropertyName7: string | number | boolean | object | symbol | bigint;
|
||||
};
|
||||
v === 'foo';
|
||||
|
||||
//// [/user/username/projects/myproject/tsconfig.json]
|
||||
{"compilerOptions":{}}
|
||||
|
||||
//// [/a/lib/lib.d.ts]
|
||||
/// <reference no-default-lib="true"/>
|
||||
interface Boolean {}
|
||||
interface Function {}
|
||||
interface CallableFunction {}
|
||||
interface NewableFunction {}
|
||||
interface IArguments {}
|
||||
interface Number { toExponential: any; }
|
||||
interface Object {}
|
||||
interface RegExp {}
|
||||
interface String { charAt: any; }
|
||||
interface Array<T> { length: number; [n: number]: T; }
|
||||
|
||||
//// [/user/username/projects/myproject/a.js]
|
||||
v === 'foo';
|
||||
|
||||
|
||||
|
||||
Output::
|
||||
>> Screen clear
|
||||
12:00:21 AM - Starting compilation in watch mode...
|
||||
|
||||
|
||||
a.ts(10,1): error TS2367: This condition will always return 'false' since the types '{ reallyLongPropertyName1: string | number | bigint | boolean | symbol | object; reallyLongPropertyName2: string | number | bigint | boolean | symbol | object; reallyLongPropertyName3: string | ... 4 more ... | object; reallyLongPropertyName4: string | ... 4 more ... | object; reallyLongPropertyName5: string | ... 4...' and 'string' have no overlap.
|
||||
|
||||
|
||||
12:00:24 AM - Found 1 error. Watching for file changes.
|
||||
|
||||
|
||||
Program root files: ["/user/username/projects/myproject/a.ts"]
|
||||
Program options: {"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"}
|
||||
Program files::
|
||||
/a/lib/lib.d.ts
|
||||
/user/username/projects/myproject/a.ts
|
||||
|
||||
Semantic diagnostics in builder refreshed for::
|
||||
/a/lib/lib.d.ts
|
||||
/user/username/projects/myproject/a.ts
|
||||
|
||||
WatchedFiles::
|
||||
/user/username/projects/myproject/tsconfig.json:
|
||||
{"pollingInterval":250}
|
||||
/user/username/projects/myproject/a.ts:
|
||||
{"pollingInterval":250}
|
||||
/a/lib/lib.d.ts:
|
||||
{"pollingInterval":250}
|
||||
|
||||
FsWatches::
|
||||
|
||||
FsWatchesRecursive::
|
||||
/user/username/projects/myproject/node_modules/@types:
|
||||
{"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}}
|
||||
/user/username/projects/myproject:
|
||||
{"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}}
|
||||
|
||||
exitCode:: ExitStatus.undefined
|
||||
|
||||
Change:: Enable noErrorTruncation
|
||||
|
||||
//// [/user/username/projects/myproject/tsconfig.json]
|
||||
{"compilerOptions":{"noErrorTruncation":true}}
|
||||
|
||||
|
||||
Output::
|
||||
>> Screen clear
|
||||
12:00:28 AM - File change detected. Starting incremental compilation...
|
||||
|
||||
|
||||
a.ts(10,1): error TS2367: This condition will always return 'false' since the types '{ reallyLongPropertyName1: string | number | bigint | boolean | symbol | object; reallyLongPropertyName2: string | number | bigint | boolean | symbol | object; reallyLongPropertyName3: string | number | bigint | boolean | symbol | object; reallyLongPropertyName4: string | number | bigint | boolean | symbol | object; reallyLongPropertyName5: string | number | bigint | boolean | symbol | object; reallyLongPropertyName6: string | number | bigint | boolean | symbol | object; reallyLongPropertyName7: string | number | bigint | boolean | symbol | object; }' and 'string' have no overlap.
|
||||
|
||||
|
||||
12:00:29 AM - Found 1 error. Watching for file changes.
|
||||
|
||||
|
||||
Program root files: ["/user/username/projects/myproject/a.ts"]
|
||||
Program options: {"noErrorTruncation":true,"watch":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"}
|
||||
Program files::
|
||||
/a/lib/lib.d.ts
|
||||
/user/username/projects/myproject/a.ts
|
||||
|
||||
Semantic diagnostics in builder refreshed for::
|
||||
/a/lib/lib.d.ts
|
||||
/user/username/projects/myproject/a.ts
|
||||
|
||||
WatchedFiles::
|
||||
/user/username/projects/myproject/tsconfig.json:
|
||||
{"pollingInterval":250}
|
||||
/user/username/projects/myproject/a.ts:
|
||||
{"pollingInterval":250}
|
||||
/a/lib/lib.d.ts:
|
||||
{"pollingInterval":250}
|
||||
|
||||
FsWatches::
|
||||
|
||||
FsWatchesRecursive::
|
||||
/user/username/projects/myproject/node_modules/@types:
|
||||
{"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}}
|
||||
/user/username/projects/myproject:
|
||||
{"fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}}
|
||||
|
||||
exitCode:: ExitStatus.undefined
|
||||
Reference in New Issue
Block a user