mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Report option diagnostic in tsconfig.json if possible
This commit is contained in:
@@ -1026,7 +1026,7 @@ namespace ts {
|
||||
case "project":
|
||||
break;
|
||||
default:
|
||||
const value = options[name];
|
||||
const value = <CompilerOptionsValue>options[name];
|
||||
const optionDefinition = optionsNameMap.get(name.toLowerCase());
|
||||
if (optionDefinition) {
|
||||
const customTypeMap = getCustomTypeMapOfCommandLineOption(optionDefinition);
|
||||
@@ -1193,6 +1193,7 @@ namespace ts {
|
||||
|
||||
options = extend(existingOptions, options);
|
||||
options.configFilePath = configFileName;
|
||||
options.configFile = sourceFile;
|
||||
|
||||
const { fileNames, wildcardDirectories } = getFileNames(errors);
|
||||
|
||||
@@ -1639,17 +1640,15 @@ namespace ts {
|
||||
|
||||
function createDiagnostic(message: DiagnosticMessage, spec: string): Diagnostic {
|
||||
if (jsonSourceFile && jsonSourceFile.jsonObject) {
|
||||
for (const property of jsonSourceFile.jsonObject.properties) {
|
||||
if (property.kind === SyntaxKind.PropertyAssignment && getTextOfPropertyName(property.name) === specKey) {
|
||||
const specsNode = <ArrayLiteralExpression>property.initializer;
|
||||
for (const element of specsNode.elements) {
|
||||
for (const property of getPropertyAssignment(jsonSourceFile.jsonObject, specKey)) {
|
||||
if (isArrayLiteralExpression(property.initializer)) {
|
||||
for (const element of property.initializer.elements) {
|
||||
if (element.kind === SyntaxKind.StringLiteral && (<StringLiteral>element).text === spec) {
|
||||
return createDiagnosticForNodeInSourceFile(jsonSourceFile, element, message, spec);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return createCompilerDiagnostic(message, spec);
|
||||
}
|
||||
|
||||
+121
-30
@@ -329,6 +329,7 @@ namespace ts {
|
||||
|
||||
// Map storing if there is emit blocking diagnostics for given input
|
||||
const hasEmitBlockingDiagnostics = createFileMap<boolean>(getCanonicalFileName);
|
||||
let _compilerOptionsObjectLiteralSyntax: ObjectLiteralExpression;
|
||||
|
||||
let moduleResolutionCache: ModuleResolutionCache;
|
||||
let resolveModuleNamesWorker: (moduleNames: string[], containingFile: string) => ResolvedModuleFull[];
|
||||
@@ -1108,6 +1109,9 @@ namespace ts {
|
||||
const allDiagnostics: Diagnostic[] = [];
|
||||
addRange(allDiagnostics, fileProcessingDiagnostics.getGlobalDiagnostics());
|
||||
addRange(allDiagnostics, programDiagnostics.getGlobalDiagnostics());
|
||||
if (options.configFile) {
|
||||
addRange(allDiagnostics, programDiagnostics.getDiagnostics(options.configFile.fileName));
|
||||
}
|
||||
return sortAndDeduplicateDiagnostics(allDiagnostics);
|
||||
}
|
||||
|
||||
@@ -1541,33 +1545,33 @@ namespace ts {
|
||||
function verifyCompilerOptions() {
|
||||
if (options.isolatedModules) {
|
||||
if (options.declaration) {
|
||||
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "declaration", "isolatedModules"));
|
||||
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "declaration", "isolatedModules");
|
||||
}
|
||||
|
||||
if (options.noEmitOnError) {
|
||||
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmitOnError", "isolatedModules"));
|
||||
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmitOnError", "isolatedModules");
|
||||
}
|
||||
|
||||
if (options.out) {
|
||||
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "isolatedModules"));
|
||||
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "isolatedModules");
|
||||
}
|
||||
|
||||
if (options.outFile) {
|
||||
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "outFile", "isolatedModules"));
|
||||
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "outFile", "isolatedModules");
|
||||
}
|
||||
}
|
||||
|
||||
if (options.inlineSourceMap) {
|
||||
if (options.sourceMap) {
|
||||
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "sourceMap", "inlineSourceMap"));
|
||||
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "sourceMap", "inlineSourceMap");
|
||||
}
|
||||
if (options.mapRoot) {
|
||||
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "mapRoot", "inlineSourceMap"));
|
||||
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "mapRoot", "inlineSourceMap");
|
||||
}
|
||||
}
|
||||
|
||||
if (options.paths && options.baseUrl === undefined) {
|
||||
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_paths_cannot_be_used_without_specifying_baseUrl_option));
|
||||
createDiagnosticForOptionName(Diagnostics.Option_paths_cannot_be_used_without_specifying_baseUrl_option, "paths");
|
||||
}
|
||||
|
||||
if (options.paths) {
|
||||
@@ -1576,63 +1580,65 @@ namespace ts {
|
||||
continue;
|
||||
}
|
||||
if (!hasZeroOrOneAsteriskCharacter(key)) {
|
||||
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Pattern_0_can_have_at_most_one_Asterisk_character, key));
|
||||
createDiagnosticForOptionPaths(/*onKey*/ true, key, Diagnostics.Pattern_0_can_have_at_most_one_Asterisk_character, key);
|
||||
}
|
||||
if (isArray(options.paths[key])) {
|
||||
if (options.paths[key].length === 0) {
|
||||
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Substitutions_for_pattern_0_shouldn_t_be_an_empty_array, key));
|
||||
const len = options.paths[key].length;
|
||||
if (len === 0) {
|
||||
createDiagnosticForOptionPaths(/*onKey*/ false, key, Diagnostics.Substitutions_for_pattern_0_shouldn_t_be_an_empty_array, key);
|
||||
}
|
||||
for (const subst of options.paths[key]) {
|
||||
for (let i = 0; i < len; i++) {
|
||||
const subst = options.paths[key][i];
|
||||
const typeOfSubst = typeof subst;
|
||||
if (typeOfSubst === "string") {
|
||||
if (!hasZeroOrOneAsteriskCharacter(subst)) {
|
||||
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Substitution_0_in_pattern_1_in_can_have_at_most_one_Asterisk_character, subst, key));
|
||||
createDiagnosticForOptionPathKeyValue(key, i, Diagnostics.Substitution_0_in_pattern_1_in_can_have_at_most_one_Asterisk_character, subst, key);
|
||||
}
|
||||
}
|
||||
else {
|
||||
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Substitution_0_for_pattern_1_has_incorrect_type_expected_string_got_2, subst, key, typeOfSubst));
|
||||
createDiagnosticForOptionPathKeyValue(key, i, Diagnostics.Substitution_0_for_pattern_1_has_incorrect_type_expected_string_got_2, subst, key, typeOfSubst);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Substitutions_for_pattern_0_should_be_an_array, key));
|
||||
createDiagnosticForOptionPaths(/*onKey*/ false, key, Diagnostics.Substitutions_for_pattern_0_should_be_an_array, key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!options.sourceMap && !options.inlineSourceMap) {
|
||||
if (options.inlineSources) {
|
||||
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided, "inlineSources"));
|
||||
createDiagnosticForOptionName(Diagnostics.Option_0_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided, "inlineSources");
|
||||
}
|
||||
if (options.sourceRoot) {
|
||||
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided, "sourceRoot"));
|
||||
createDiagnosticForOptionName(Diagnostics.Option_0_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided, "sourceRoot");
|
||||
}
|
||||
}
|
||||
|
||||
if (options.out && options.outFile) {
|
||||
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "outFile"));
|
||||
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "outFile");
|
||||
}
|
||||
|
||||
if (options.mapRoot && !options.sourceMap) {
|
||||
// Error to specify --mapRoot without --sourcemap
|
||||
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "mapRoot", "sourceMap"));
|
||||
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "mapRoot", "sourceMap");
|
||||
}
|
||||
|
||||
if (options.declarationDir) {
|
||||
if (!options.declaration) {
|
||||
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "declarationDir", "declaration"));
|
||||
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "declarationDir", "declaration");
|
||||
}
|
||||
if (options.out || options.outFile) {
|
||||
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "declarationDir", options.out ? "out" : "outFile"));
|
||||
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "declarationDir", options.out ? "out" : "outFile");
|
||||
}
|
||||
}
|
||||
|
||||
if (options.lib && options.noLib) {
|
||||
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "lib", "noLib"));
|
||||
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "lib", "noLib");
|
||||
}
|
||||
|
||||
if (options.noImplicitUseStrict && options.alwaysStrict) {
|
||||
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "noImplicitUseStrict", "alwaysStrict"));
|
||||
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "noImplicitUseStrict", "alwaysStrict");
|
||||
}
|
||||
|
||||
const languageVersion = options.target || ScriptTarget.ES3;
|
||||
@@ -1641,7 +1647,7 @@ namespace ts {
|
||||
const firstNonAmbientExternalModuleSourceFile = forEach(files, f => isExternalModule(f) && !isDeclarationFile(f) ? f : undefined);
|
||||
if (options.isolatedModules) {
|
||||
if (options.module === ModuleKind.None && languageVersion < ScriptTarget.ES2015) {
|
||||
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES2015_or_higher));
|
||||
createDiagnosticForOptionName(Diagnostics.Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES2015_or_higher, "isolatedModules", "target");
|
||||
}
|
||||
|
||||
const firstNonExternalModuleSourceFile = forEach(files, f => !isExternalModule(f) && !isDeclarationFile(f) ? f : undefined);
|
||||
@@ -1659,7 +1665,7 @@ namespace ts {
|
||||
// Cannot specify module gen that isn't amd or system with --out
|
||||
if (outFile) {
|
||||
if (options.module && !(options.module === ModuleKind.AMD || options.module === ModuleKind.System)) {
|
||||
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Only_amd_and_system_modules_are_supported_alongside_0, options.out ? "out" : "outFile"));
|
||||
createDiagnosticForOptionName(Diagnostics.Only_amd_and_system_modules_are_supported_alongside_0, options.out ? "out" : "outFile", "module");
|
||||
}
|
||||
else if (options.module === undefined && firstNonAmbientExternalModuleSourceFile) {
|
||||
const span = getErrorSpanForNode(firstNonAmbientExternalModuleSourceFile, firstNonAmbientExternalModuleSourceFile.externalModuleIndicator);
|
||||
@@ -1678,29 +1684,29 @@ namespace ts {
|
||||
|
||||
// If we failed to find a good common directory, but outDir is specified and at least one of our files is on a windows drive/URL/other resource, add a failure
|
||||
if (options.outDir && dir === "" && forEach(files, file => getRootLength(file.fileName) > 1)) {
|
||||
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files));
|
||||
createDiagnosticForOptionName(Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files, "outDir");
|
||||
}
|
||||
}
|
||||
|
||||
if (!options.noEmit && options.allowJs && options.declaration) {
|
||||
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "allowJs", "declaration"));
|
||||
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "allowJs", "declaration");
|
||||
}
|
||||
|
||||
if (options.emitDecoratorMetadata &&
|
||||
!options.experimentalDecorators) {
|
||||
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "emitDecoratorMetadata", "experimentalDecorators"));
|
||||
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "emitDecoratorMetadata", "experimentalDecorators");
|
||||
}
|
||||
|
||||
if (options.jsxFactory) {
|
||||
if (options.reactNamespace) {
|
||||
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "reactNamespace", "jsxFactory"));
|
||||
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "reactNamespace", "jsxFactory");
|
||||
}
|
||||
if (!parseIsolatedEntityName(options.jsxFactory, languageVersion)) {
|
||||
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Invalid_value_for_jsxFactory_0_is_not_a_valid_identifier_or_qualified_name, options.jsxFactory));
|
||||
createOptionValueDiagnostic("jsxFactory", Diagnostics.Invalid_value_for_jsxFactory_0_is_not_a_valid_identifier_or_qualified_name, options.jsxFactory);
|
||||
}
|
||||
}
|
||||
else if (options.reactNamespace && !isIdentifierText(options.reactNamespace, languageVersion)) {
|
||||
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Invalid_value_for_reactNamespace_0_is_not_a_valid_identifier, options.reactNamespace));
|
||||
createOptionValueDiagnostic("reactNamespace", Diagnostics.Invalid_value_for_reactNamespace_0_is_not_a_valid_identifier, options.reactNamespace);
|
||||
}
|
||||
|
||||
// If the emit is enabled make sure that every output file is unique and not overwriting any of the input files
|
||||
@@ -1740,6 +1746,91 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
function createDiagnosticForOptionPathKeyValue(key: string, valueIndex: number, message: DiagnosticMessage, arg0: string | number, arg1: string | number, arg2?: string | number) {
|
||||
let needCompilerDiagnostic = true;
|
||||
const pathsSyntax = getOptionPathsSyntax();
|
||||
for (const pathProp of pathsSyntax) {
|
||||
if (isObjectLiteralExpression(pathProp.initializer)) {
|
||||
for (const keyProps of getPropertyAssignment(pathProp.initializer, key)) {
|
||||
if (isArrayLiteralExpression(keyProps.initializer) &&
|
||||
keyProps.initializer.elements.length > valueIndex) {
|
||||
programDiagnostics.add(createDiagnosticForNodeInSourceFile(options.configFile, keyProps.initializer.elements[valueIndex], message, arg0, arg1, arg2));
|
||||
needCompilerDiagnostic = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (needCompilerDiagnostic) {
|
||||
programDiagnostics.add(createCompilerDiagnostic(message, arg0, arg1, arg2));
|
||||
}
|
||||
}
|
||||
|
||||
function createDiagnosticForOptionPaths(onKey: boolean, key: string, message: DiagnosticMessage, arg0: string | number) {
|
||||
let needCompilerDiagnostic = true;
|
||||
const pathsSyntax = getOptionPathsSyntax();
|
||||
for (const pathProp of pathsSyntax) {
|
||||
if (isObjectLiteralExpression(pathProp.initializer) &&
|
||||
createOptionDiagnosticInObjectLiteralSyntax(
|
||||
pathProp.initializer, onKey, key, /*key2*/undefined,
|
||||
message, arg0)) {
|
||||
needCompilerDiagnostic = false;
|
||||
}
|
||||
}
|
||||
if (needCompilerDiagnostic) {
|
||||
programDiagnostics.add(createCompilerDiagnostic(message, arg0));
|
||||
}
|
||||
}
|
||||
|
||||
function getOptionPathsSyntax() {
|
||||
const compilerOptionsObjectLiteralSyntax = getCompilerOptionsObjectLiteralSyntax();
|
||||
if (compilerOptionsObjectLiteralSyntax) {
|
||||
return getPropertyAssignment(compilerOptionsObjectLiteralSyntax, "paths");
|
||||
}
|
||||
return emptyArray;
|
||||
}
|
||||
|
||||
function createDiagnosticForOptionName(message: DiagnosticMessage, option1: string, option2?: string) {
|
||||
createDiagnosticForOption(/*onKey*/ true, option1, option2, message, option1, option2);
|
||||
}
|
||||
|
||||
function createOptionValueDiagnostic(option1: string, message: DiagnosticMessage, arg0: string) {
|
||||
createDiagnosticForOption(/*onKey*/ false, option1, /*option2*/ undefined, message, arg0);
|
||||
}
|
||||
|
||||
function createDiagnosticForOption(onKey: boolean, option1: string, option2: string, message: DiagnosticMessage, arg0: string | number, arg1?: string | number) {
|
||||
const compilerOptionsObjectLiteralSyntax = getCompilerOptionsObjectLiteralSyntax();
|
||||
const needCompilerDiagnostic = !compilerOptionsObjectLiteralSyntax ||
|
||||
!createOptionDiagnosticInObjectLiteralSyntax(compilerOptionsObjectLiteralSyntax, onKey, option1, option2, message, arg0, arg1);
|
||||
|
||||
if (needCompilerDiagnostic) {
|
||||
programDiagnostics.add(createCompilerDiagnostic(message, arg0, arg1));
|
||||
}
|
||||
}
|
||||
|
||||
function getCompilerOptionsObjectLiteralSyntax() {
|
||||
if (_compilerOptionsObjectLiteralSyntax === undefined) {
|
||||
_compilerOptionsObjectLiteralSyntax = null; // tslint:disable-line:no-null-keyword
|
||||
if (options.configFile && options.configFile.jsonObject) {
|
||||
for (const prop of getPropertyAssignment(options.configFile.jsonObject, "compilerOptions")) {
|
||||
if (isObjectLiteralExpression(prop.initializer)) {
|
||||
_compilerOptionsObjectLiteralSyntax = prop.initializer;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return _compilerOptionsObjectLiteralSyntax;
|
||||
}
|
||||
|
||||
function createOptionDiagnosticInObjectLiteralSyntax(objectLiteral: ObjectLiteralExpression, onKey: boolean, key1: string, key2: string, message: DiagnosticMessage, arg0: string | number, arg1?: string | number): boolean {
|
||||
const props = getPropertyAssignment(objectLiteral, key1, key2);
|
||||
for (const prop of props) {
|
||||
programDiagnostics.add(createDiagnosticForNodeInSourceFile(options.configFile, onKey ? prop.name : prop.initializer, message, arg0, arg1));
|
||||
}
|
||||
return !!props.length;
|
||||
}
|
||||
|
||||
function blockEmittingOfFile(emitFileName: string, diag: Diagnostic) {
|
||||
hasEmitBlockingDiagnostics.set(toPath(emitFileName, currentDirectory, getCanonicalFileName), true);
|
||||
programDiagnostics.add(diag);
|
||||
|
||||
@@ -3198,6 +3198,7 @@
|
||||
baseUrl?: string;
|
||||
charset?: string;
|
||||
/* @internal */ configFilePath?: string;
|
||||
/* @internal */ configFile?: JsonSourceFile;
|
||||
declaration?: boolean;
|
||||
declarationDir?: string;
|
||||
/* @internal */ diagnostics?: boolean;
|
||||
@@ -3266,7 +3267,7 @@
|
||||
/*@internal*/ version?: boolean;
|
||||
/*@internal*/ watch?: boolean;
|
||||
|
||||
[option: string]: CompilerOptionsValue | undefined;
|
||||
[option: string]: CompilerOptionsValue | JsonSourceFile | undefined;
|
||||
}
|
||||
|
||||
export interface TypeAcquisition {
|
||||
|
||||
@@ -948,6 +948,15 @@ namespace ts {
|
||||
return predicate && predicate.kind === TypePredicateKind.This;
|
||||
}
|
||||
|
||||
export function getPropertyAssignment(objectLiteral: ObjectLiteralExpression, key: string, key2?: string) {
|
||||
return <PropertyAssignment[]>filter(objectLiteral.properties, property => {
|
||||
if (property.kind === SyntaxKind.PropertyAssignment) {
|
||||
const propName = getTextOfPropertyName(property.name);
|
||||
return key === propName || (key2 && key2 === propName);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
export function getContainingFunction(node: Node): FunctionLikeDeclaration {
|
||||
while (true) {
|
||||
node = node.parent;
|
||||
|
||||
@@ -64,6 +64,7 @@ class CompilerBaselineRunner extends RunnerBase {
|
||||
|
||||
let result: Harness.Compiler.CompilerResult;
|
||||
let options: ts.CompilerOptions;
|
||||
let tsConfigFiles: Harness.Compiler.TestFile[];
|
||||
// equivalent to the files that will be passed on the command line
|
||||
let toBeCompiled: Harness.Compiler.TestFile[];
|
||||
// equivalent to other files on the file system not directly passed to the compiler (ie things that are referenced by other files)
|
||||
@@ -77,10 +78,12 @@ class CompilerBaselineRunner extends RunnerBase {
|
||||
const units = testCaseContent.testUnitData;
|
||||
harnessSettings = testCaseContent.settings;
|
||||
let tsConfigOptions: ts.CompilerOptions;
|
||||
tsConfigFiles = [];
|
||||
if (testCaseContent.tsConfig) {
|
||||
assert.equal(testCaseContent.tsConfig.fileNames.length, 0, `list of files in tsconfig is not currently supported`);
|
||||
|
||||
tsConfigOptions = ts.clone(testCaseContent.tsConfig.options);
|
||||
tsConfigFiles.push(this.createHarnessTestFile(testCaseContent.tsConfigFileUnitData, rootDir, ts.combinePaths(rootDir, tsConfigOptions.configFilePath)));
|
||||
}
|
||||
else {
|
||||
const baseUrl = harnessSettings["baseUrl"];
|
||||
@@ -98,21 +101,22 @@ class CompilerBaselineRunner extends RunnerBase {
|
||||
otherFiles = [];
|
||||
|
||||
if (testCaseContent.settings["noImplicitReferences"] || /require\(/.test(lastUnit.content) || /reference\spath/.test(lastUnit.content)) {
|
||||
toBeCompiled.push({ unitName: this.makeUnitName(lastUnit.name, rootDir), content: lastUnit.content, fileOptions: lastUnit.fileOptions });
|
||||
toBeCompiled.push(this.createHarnessTestFile(lastUnit, rootDir));
|
||||
units.forEach(unit => {
|
||||
if (unit.name !== lastUnit.name) {
|
||||
otherFiles.push({ unitName: this.makeUnitName(unit.name, rootDir), content: unit.content, fileOptions: unit.fileOptions });
|
||||
otherFiles.push(this.createHarnessTestFile(unit, rootDir));
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
toBeCompiled = units.map(unit => {
|
||||
return { unitName: this.makeUnitName(unit.name, rootDir), content: unit.content, fileOptions: unit.fileOptions };
|
||||
return this.createHarnessTestFile(unit, rootDir);
|
||||
});
|
||||
}
|
||||
|
||||
if (tsConfigOptions && tsConfigOptions.configFilePath !== undefined) {
|
||||
tsConfigOptions.configFilePath = ts.combinePaths(rootDir, tsConfigOptions.configFilePath);
|
||||
tsConfigOptions.configFile.fileName = tsConfigOptions.configFilePath;
|
||||
}
|
||||
|
||||
const output = Harness.Compiler.compileFiles(
|
||||
@@ -132,11 +136,12 @@ class CompilerBaselineRunner extends RunnerBase {
|
||||
options = undefined;
|
||||
toBeCompiled = undefined;
|
||||
otherFiles = undefined;
|
||||
tsConfigFiles = undefined;
|
||||
});
|
||||
|
||||
// check errors
|
||||
it("Correct errors for " + fileName, () => {
|
||||
Harness.Compiler.doErrorBaseline(justName, toBeCompiled.concat(otherFiles), result.errors);
|
||||
Harness.Compiler.doErrorBaseline(justName, tsConfigFiles.concat(toBeCompiled, otherFiles), result.errors);
|
||||
});
|
||||
|
||||
it (`Correct module resolution tracing for ${fileName}`, () => {
|
||||
@@ -165,7 +170,7 @@ class CompilerBaselineRunner extends RunnerBase {
|
||||
|
||||
it("Correct JS output for " + fileName, () => {
|
||||
if (hasNonDtsFiles && this.emit) {
|
||||
Harness.Compiler.doJsEmitBaseline(justName, fileName, options, result, toBeCompiled, otherFiles, harnessSettings);
|
||||
Harness.Compiler.doJsEmitBaseline(justName, fileName, options, result, tsConfigFiles, toBeCompiled, otherFiles, harnessSettings);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -183,6 +188,10 @@ class CompilerBaselineRunner extends RunnerBase {
|
||||
});
|
||||
}
|
||||
|
||||
private createHarnessTestFile(lastUnit: Harness.TestCaseParser.TestUnitData, rootDir: string, unitName?: string): Harness.Compiler.TestFile {
|
||||
return { unitName: unitName || this.makeUnitName(lastUnit.name, rootDir), content: lastUnit.content, fileOptions: lastUnit.fileOptions };
|
||||
}
|
||||
|
||||
public initializeTests() {
|
||||
describe(this.testSuiteName + " tests", () => {
|
||||
describe("Setup compiler for compiler baselines", () => {
|
||||
|
||||
+11
-4
@@ -1614,7 +1614,7 @@ namespace Harness {
|
||||
}
|
||||
}
|
||||
|
||||
export function doJsEmitBaseline(baselinePath: string, header: string, options: ts.CompilerOptions, result: CompilerResult, toBeCompiled: Harness.Compiler.TestFile[], otherFiles: Harness.Compiler.TestFile[], harnessSettings: Harness.TestCaseParser.CompilerSettings) {
|
||||
export function doJsEmitBaseline(baselinePath: string, header: string, options: ts.CompilerOptions, result: CompilerResult, tsConfigFiles: Harness.Compiler.TestFile[], toBeCompiled: Harness.Compiler.TestFile[], otherFiles: Harness.Compiler.TestFile[], harnessSettings: Harness.TestCaseParser.CompilerSettings) {
|
||||
if (!options.noEmit && result.files.length === 0 && result.errors.length === 0) {
|
||||
throw new Error("Expected at least one js file to be emitted or at least one error to be created.");
|
||||
}
|
||||
@@ -1650,7 +1650,7 @@ namespace Harness {
|
||||
if (declFileCompilationResult && declFileCompilationResult.declResult.errors.length) {
|
||||
jsCode += "\r\n\r\n//// [DtsFileErrors]\r\n";
|
||||
jsCode += "\r\n\r\n";
|
||||
jsCode += Harness.Compiler.getErrorBaseline(declFileCompilationResult.declInputFiles.concat(declFileCompilationResult.declOtherFiles), declFileCompilationResult.declResult.errors);
|
||||
jsCode += Harness.Compiler.getErrorBaseline(tsConfigFiles.concat(declFileCompilationResult.declInputFiles, declFileCompilationResult.declOtherFiles), declFileCompilationResult.declResult.errors);
|
||||
}
|
||||
|
||||
if (jsCode.length > 0) {
|
||||
@@ -1801,7 +1801,12 @@ namespace Harness {
|
||||
}
|
||||
|
||||
/** Given a test file containing // @FileName directives, return an array of named units of code to be added to an existing compiler instance */
|
||||
export function makeUnitsFromTest(code: string, fileName: string, rootDir?: string): { settings: CompilerSettings; testUnitData: TestUnitData[]; tsConfig: ts.ParsedCommandLine } {
|
||||
export function makeUnitsFromTest(code: string, fileName: string, rootDir?: string): {
|
||||
settings: CompilerSettings;
|
||||
testUnitData: TestUnitData[];
|
||||
tsConfig: ts.ParsedCommandLine;
|
||||
tsConfigFileUnitData: TestUnitData;
|
||||
} {
|
||||
const settings = extractCompilerSettings(code);
|
||||
|
||||
// List of all the subfiles we've parsed out
|
||||
@@ -1887,6 +1892,7 @@ namespace Harness {
|
||||
|
||||
// check if project has tsconfig.json in the list of files
|
||||
let tsConfig: ts.ParsedCommandLine;
|
||||
let tsConfigFileUnitData: TestUnitData;
|
||||
for (let i = 0; i < testUnitData.length; i++) {
|
||||
const data = testUnitData[i];
|
||||
if (ts.getBaseFileName(data.name).toLowerCase() === "tsconfig.json") {
|
||||
@@ -1898,6 +1904,7 @@ namespace Harness {
|
||||
}
|
||||
tsConfig = ts.parseJsonSourceFileConfigFileContent(configJson, parseConfigHost, baseDir);
|
||||
tsConfig.options.configFilePath = data.name;
|
||||
tsConfigFileUnitData = data;
|
||||
|
||||
// delete entry from the list
|
||||
ts.orderedRemoveItemAt(testUnitData, i);
|
||||
@@ -1905,7 +1912,7 @@ namespace Harness {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return { settings, testUnitData, tsConfig };
|
||||
return { settings, testUnitData, tsConfig, tsConfigFileUnitData };
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ interface BatchCompileProjectTestCaseEmittedFile extends Harness.Compiler.Genera
|
||||
}
|
||||
|
||||
interface CompileProjectFilesResult {
|
||||
configFileSourceFiles: ts.SourceFile[];
|
||||
moduleKind: ts.ModuleKind;
|
||||
program?: ts.Program;
|
||||
compilerOptions?: ts.CompilerOptions;
|
||||
@@ -125,7 +126,8 @@ class ProjectRunner extends RunnerBase {
|
||||
return Harness.IO.resolvePath(testCase.projectRoot);
|
||||
}
|
||||
|
||||
function compileProjectFiles(moduleKind: ts.ModuleKind, getInputFiles: () => string[],
|
||||
function compileProjectFiles(moduleKind: ts.ModuleKind, configFileSourceFiles: ts.SourceFile[],
|
||||
getInputFiles: () => string[],
|
||||
getSourceFileTextImpl: (fileName: string) => string,
|
||||
writeFile: (fileName: string, data: string, writeByteOrderMark: boolean) => void,
|
||||
compilerOptions: ts.CompilerOptions): CompileProjectFilesResult {
|
||||
@@ -149,6 +151,7 @@ class ProjectRunner extends RunnerBase {
|
||||
}
|
||||
|
||||
return {
|
||||
configFileSourceFiles,
|
||||
moduleKind,
|
||||
program,
|
||||
errors,
|
||||
@@ -197,6 +200,7 @@ class ProjectRunner extends RunnerBase {
|
||||
const outputFiles: BatchCompileProjectTestCaseEmittedFile[] = [];
|
||||
let inputFiles = testCase.inputFiles;
|
||||
let compilerOptions = createCompilerOptions();
|
||||
const configFileSourceFiles: ts.SourceFile[] = [];
|
||||
|
||||
let configFileName: string;
|
||||
if (compilerOptions.project) {
|
||||
@@ -211,6 +215,7 @@ class ProjectRunner extends RunnerBase {
|
||||
let errors: ts.Diagnostic[];
|
||||
if (configFileName) {
|
||||
const result = ts.readConfigFileToJsonSourceFile(configFileName, getSourceFileText);
|
||||
configFileSourceFiles.push(result);
|
||||
const configParseHost: ts.ParseConfigHost = {
|
||||
useCaseSensitiveFileNames: Harness.IO.useCaseSensitiveFileNames(),
|
||||
fileExists,
|
||||
@@ -220,6 +225,7 @@ class ProjectRunner extends RunnerBase {
|
||||
const configParseResult = ts.parseJsonSourceFileConfigFileContent(result, configParseHost, ts.getDirectoryPath(configFileName), compilerOptions);
|
||||
if (configParseResult.errors.length > 0) {
|
||||
return {
|
||||
configFileSourceFiles,
|
||||
moduleKind,
|
||||
errors: result.parseDiagnostics.concat(configParseResult.errors)
|
||||
};
|
||||
@@ -229,8 +235,9 @@ class ProjectRunner extends RunnerBase {
|
||||
errors = result.parseDiagnostics;
|
||||
}
|
||||
|
||||
const projectCompilerResult = compileProjectFiles(moduleKind, () => inputFiles, getSourceFileText, writeFile, compilerOptions);
|
||||
const projectCompilerResult = compileProjectFiles(moduleKind, configFileSourceFiles, () => inputFiles, getSourceFileText, writeFile, compilerOptions);
|
||||
return {
|
||||
configFileSourceFiles,
|
||||
moduleKind,
|
||||
program: projectCompilerResult.program,
|
||||
compilerOptions,
|
||||
@@ -397,7 +404,7 @@ class ProjectRunner extends RunnerBase {
|
||||
});
|
||||
|
||||
// Dont allow config files since we are compiling existing source options
|
||||
return compileProjectFiles(compilerResult.moduleKind, getInputFiles, getSourceFileText, writeFile, compilerResult.compilerOptions);
|
||||
return compileProjectFiles(compilerResult.moduleKind, compilerResult.configFileSourceFiles, getInputFiles, getSourceFileText, writeFile, compilerResult.compilerOptions);
|
||||
|
||||
function findOutputDtsFile(fileName: string) {
|
||||
return ts.forEach(compilerResult.outputFiles, outputFile => outputFile.emittedFileName === fileName ? outputFile : undefined);
|
||||
@@ -423,16 +430,16 @@ class ProjectRunner extends RunnerBase {
|
||||
}
|
||||
|
||||
function getErrorsBaseline(compilerResult: CompileProjectFilesResult) {
|
||||
const inputFiles = compilerResult.program ? ts.map(ts.filter(compilerResult.program.getSourceFiles(),
|
||||
sourceFile => !Harness.isDefaultLibraryFile(sourceFile.fileName)),
|
||||
sourceFile => {
|
||||
return {
|
||||
unitName: ts.isRootedDiskPath(sourceFile.fileName) ?
|
||||
RunnerBase.removeFullPaths(sourceFile.fileName) :
|
||||
sourceFile.fileName,
|
||||
content: sourceFile.text
|
||||
};
|
||||
}) : [];
|
||||
const inputFiles = ts.map(compilerResult.configFileSourceFiles.concat(
|
||||
compilerResult.program ?
|
||||
ts.filter(compilerResult.program.getSourceFiles(), sourceFile => !Harness.isDefaultLibraryFile(sourceFile.fileName)) :
|
||||
[]),
|
||||
sourceFile => <Harness.Compiler.TestFile>{
|
||||
unitName: ts.isRootedDiskPath(sourceFile.fileName) ?
|
||||
RunnerBase.removeFullPaths(sourceFile.fileName) :
|
||||
sourceFile.fileName,
|
||||
content: sourceFile.text
|
||||
});
|
||||
|
||||
return Harness.Compiler.getErrorBaseline(inputFiles, compilerResult.errors);
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ namespace RWC {
|
||||
describe("Testing a RWC project: " + jsonPath, () => {
|
||||
let inputFiles: Harness.Compiler.TestFile[] = [];
|
||||
let otherFiles: Harness.Compiler.TestFile[] = [];
|
||||
let tsconfigFiles: Harness.Compiler.TestFile[] = [];
|
||||
let compilerResult: Harness.Compiler.CompilerResult;
|
||||
let compilerOptions: ts.CompilerOptions;
|
||||
const baselineOpts: Harness.Baseline.BaselineOptions = {
|
||||
@@ -44,6 +45,7 @@ namespace RWC {
|
||||
// Therefore we have to clean out large objects after the test is done.
|
||||
inputFiles = [];
|
||||
otherFiles = [];
|
||||
tsconfigFiles = [];
|
||||
compilerResult = undefined;
|
||||
compilerOptions = undefined;
|
||||
currentDirectory = undefined;
|
||||
@@ -74,6 +76,7 @@ namespace RWC {
|
||||
const tsconfigFile = ts.forEach(ioLog.filesRead, f => isTsConfigFile(f) ? f : undefined);
|
||||
if (tsconfigFile) {
|
||||
const tsconfigFileContents = getHarnessCompilerInputUnit(tsconfigFile.path);
|
||||
tsconfigFiles.push({ unitName: tsconfigFile.path, content: tsconfigFileContents.content });
|
||||
const parsedTsconfigFileContents = ts.parseJsonText(tsconfigFile.path, tsconfigFileContents.content);
|
||||
const configParseHost: ts.ParseConfigHost = {
|
||||
useCaseSensitiveFileNames: Harness.IO.useCaseSensitiveFileNames(),
|
||||
@@ -198,8 +201,8 @@ namespace RWC {
|
||||
return null;
|
||||
}
|
||||
// Do not include the library in the baselines to avoid noise
|
||||
const baselineFiles = inputFiles.concat(otherFiles).filter(f => !Harness.isDefaultLibraryFile(f.unitName));
|
||||
const errors = compilerResult.errors.filter(e => e.file && !Harness.isDefaultLibraryFile(e.file.fileName));
|
||||
const baselineFiles = tsconfigFiles.concat(inputFiles, otherFiles).filter(f => !Harness.isDefaultLibraryFile(f.unitName));
|
||||
const errors = compilerResult.errors.filter(e => !e.file || !Harness.isDefaultLibraryFile(e.file.fileName));
|
||||
return Harness.Compiler.getErrorBaseline(baselineFiles, errors);
|
||||
}, baselineOpts);
|
||||
});
|
||||
@@ -218,7 +221,7 @@ namespace RWC {
|
||||
|
||||
return Harness.Compiler.minimalDiagnosticsToString(declFileCompilationResult.declResult.errors) +
|
||||
Harness.IO.newLine() + Harness.IO.newLine() +
|
||||
Harness.Compiler.getErrorBaseline(declFileCompilationResult.declInputFiles.concat(declFileCompilationResult.declOtherFiles), declFileCompilationResult.declResult.errors);
|
||||
Harness.Compiler.getErrorBaseline(tsconfigFiles.concat(declFileCompilationResult.declInputFiles, declFileCompilationResult.declOtherFiles), declFileCompilationResult.declResult.errors);
|
||||
}, baselineOpts);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -119,23 +119,25 @@ namespace ts {
|
||||
function getParseCommandLineJsonSourceFile(entry: string) {
|
||||
const jsonSourceFile = ts.readConfigFileToJsonSourceFile(entry, name => host.readFile(name));
|
||||
assert(jsonSourceFile.endOfFileToken && !jsonSourceFile.parseDiagnostics.length, flattenDiagnosticMessageText(jsonSourceFile.parseDiagnostics[0] && jsonSourceFile.parseDiagnostics[0].messageText, "\n"));
|
||||
return ts.parseJsonSourceFileConfigFileContent(jsonSourceFile, host, basePath, {}, entry);
|
||||
return {
|
||||
jsonSourceFile,
|
||||
parsed: ts.parseJsonSourceFileConfigFileContent(jsonSourceFile, host, basePath, {}, entry)
|
||||
};
|
||||
}
|
||||
|
||||
function testSuccess(name: string, entry: string, expected: CompilerOptions, expectedFiles: string[]) {
|
||||
expected.configFilePath = entry;
|
||||
it(name, () => {
|
||||
const parsed = getParseCommandLine(entry);
|
||||
assert(!parsed.errors.length, flattenDiagnosticMessageText(parsed.errors[0] && parsed.errors[0].messageText, "\n"));
|
||||
expected.configFilePath = entry;
|
||||
assert.deepEqual(parsed.options, expected);
|
||||
assert.deepEqual(parsed.options, ts.extend(expected, <CompilerOptions>{ configFile: undefined }));
|
||||
assert.deepEqual(parsed.fileNames, expectedFiles);
|
||||
});
|
||||
|
||||
it(name + "with jsonSourceFile", () => {
|
||||
const parsed = getParseCommandLineJsonSourceFile(entry);
|
||||
it(name + " with jsonSourceFile", () => {
|
||||
const { parsed, jsonSourceFile } = getParseCommandLineJsonSourceFile(entry);
|
||||
assert(!parsed.errors.length, flattenDiagnosticMessageText(parsed.errors[0] && parsed.errors[0].messageText, "\n"));
|
||||
expected.configFilePath = entry;
|
||||
assert.deepEqual(parsed.options, expected);
|
||||
assert.deepEqual(parsed.options, ts.extend(expected, <CompilerOptions>{ configFile: jsonSourceFile }));
|
||||
assert.deepEqual(parsed.fileNames, expectedFiles);
|
||||
});
|
||||
}
|
||||
@@ -146,8 +148,8 @@ namespace ts {
|
||||
verifyDiagnostics(parsed.errors, expectedDiagnostics);
|
||||
});
|
||||
|
||||
it(name + "with jsonSourceFile", () => {
|
||||
const parsed = getParseCommandLineJsonSourceFile(entry);
|
||||
it(name + " with jsonSourceFile", () => {
|
||||
const { parsed } = getParseCommandLineJsonSourceFile(entry);
|
||||
verifyDiagnostics(parsed.errors, expectedDiagnostics);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ namespace ts {
|
||||
const host: ParseConfigHost = new Utils.MockParseConfigHost("/apath/", true, []);
|
||||
const { options: actualCompilerOptions, errors: actualParseErrors } = parseJsonSourceFileConfigFileContent(result, host, "/apath/", /*existingOptions*/ undefined, configFileName);
|
||||
expectedResult.compilerOptions["configFilePath"] = configFileName;
|
||||
expectedResult.compilerOptions.configFile = result;
|
||||
|
||||
const parsedCompilerOptions = JSON.stringify(actualCompilerOptions);
|
||||
const expectedCompilerOptions = JSON.stringify(expectedResult.compilerOptions);
|
||||
|
||||
@@ -1216,8 +1216,20 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
const currentOptions = program.getCompilerOptions();
|
||||
const newOptions = hostCache.compilationSettings();
|
||||
// If the compilation settings do no match, then the program is not up-to-date
|
||||
return compareDataObjects(program.getCompilerOptions(), hostCache.compilationSettings());
|
||||
if (!compareDataObjects(currentOptions, newOptions, "configFile")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// If everything matches but the text of config file is changed,
|
||||
// error locations can change for program options, so update the program
|
||||
if (currentOptions.configFile && newOptions.configFile) {
|
||||
return currentOptions.configFile.text === newOptions.configFile.text;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1047,8 +1047,12 @@ namespace ts {
|
||||
return false;
|
||||
}
|
||||
|
||||
export function compareDataObjects(dst: any, src: any): boolean {
|
||||
export function compareDataObjects(dst: any, src: any, ignoreKey?: string): boolean {
|
||||
for (const e in dst) {
|
||||
if (ignoreKey && ignoreKey === e) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (typeof dst[e] === "object") {
|
||||
if (!compareDataObjects(dst[e], src[e])) {
|
||||
return false;
|
||||
|
||||
@@ -1,6 +1,17 @@
|
||||
/index.ts(4,5): error TS2339: Property 'y' does not exist on type 'typeof "shortid"'.
|
||||
|
||||
|
||||
==== /tsconfig.json (0 errors) ====
|
||||
|
||||
{
|
||||
"compileOnSave": true,
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"moduleResolution": "node",
|
||||
"outDir": "bin"
|
||||
},
|
||||
"exclude": [ "node_modules" ]
|
||||
}
|
||||
==== /index.ts (1 errors) ====
|
||||
/// <reference path="/typings/index.d.ts" />
|
||||
import * as foo from "shortid";
|
||||
|
||||
@@ -1,7 +1,23 @@
|
||||
error TS5060: Option 'paths' cannot be used without specifying '--baseUrl' option.
|
||||
c:/root/tsconfig.json(6,9): error TS5060: Option 'paths' cannot be used without specifying '--baseUrl' option.
|
||||
|
||||
|
||||
==== c:/root/tsconfig.json (1 errors) ====
|
||||
|
||||
// paths should error in the absence of baseurl
|
||||
|
||||
{
|
||||
"compilerOptions": {
|
||||
"paths": {
|
||||
~~~~~~~
|
||||
!!! error TS5060: Option 'paths' cannot be used without specifying '--baseUrl' option.
|
||||
"*": [
|
||||
"*",
|
||||
"generated/*"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
==== c:/root/f1.ts (0 errors) ====
|
||||
export var x = 1;
|
||||
|
||||
@@ -1,7 +1,22 @@
|
||||
error TS5060: Option 'paths' cannot be used without specifying '--baseUrl' option.
|
||||
c:/root/tsconfig.json(5,9): error TS5060: Option 'paths' cannot be used without specifying '--baseUrl' option.
|
||||
|
||||
|
||||
==== c:/root/tsconfig.json (1 errors) ====
|
||||
|
||||
// paths should error in the absence of baseurl
|
||||
{
|
||||
"compilerOptions": {
|
||||
"paths": {
|
||||
~~~~~~~
|
||||
!!! error TS5060: Option 'paths' cannot be used without specifying '--baseUrl' option.
|
||||
"*": [
|
||||
"*",
|
||||
"generated/*"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
==== c:/root/f1.ts (0 errors) ====
|
||||
export var x = 1;
|
||||
|
||||
@@ -1,8 +1,24 @@
|
||||
error TS5061: Pattern '*1*' can have at most one '*' character
|
||||
error TS5062: Substitution '*2*' in pattern '*1*' in can have at most one '*' character
|
||||
tests/cases/compiler/root/tsconfig.json(9,13): error TS5061: Pattern '*1*' can have at most one '*' character
|
||||
tests/cases/compiler/root/tsconfig.json(9,22): error TS5062: Substitution '*2*' in pattern '*1*' in can have at most one '*' character
|
||||
|
||||
|
||||
==== tests/cases/compiler/root/tsconfig.json (2 errors) ====
|
||||
|
||||
// baseurl is defined in tsconfig.json
|
||||
// paths has errors
|
||||
|
||||
{
|
||||
"compilerOptions": {
|
||||
"baseUrl": "./src",
|
||||
"paths": {
|
||||
"*1*": [ "*2*" ]
|
||||
~~~~~
|
||||
!!! error TS5061: Pattern '*1*' can have at most one '*' character
|
||||
~~~~~
|
||||
!!! error TS5062: Substitution '*2*' in pattern '*1*' in can have at most one '*' character
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
==== tests/cases/compiler/root/src/folder1/file1.ts (0 errors) ====
|
||||
export var x = 1;
|
||||
@@ -1,8 +1,24 @@
|
||||
error TS5061: Pattern '*1*' can have at most one '*' character
|
||||
error TS5062: Substitution '*2*' in pattern '*1*' in can have at most one '*' character
|
||||
tests/cases/compiler/root/tsconfig.json(9,13): error TS5061: Pattern '*1*' can have at most one '*' character
|
||||
tests/cases/compiler/root/tsconfig.json(9,22): error TS5062: Substitution '*2*' in pattern '*1*' in can have at most one '*' character
|
||||
|
||||
|
||||
==== tests/cases/compiler/root/tsconfig.json (2 errors) ====
|
||||
|
||||
// baseurl is defined in tsconfig.json
|
||||
// paths has errors
|
||||
|
||||
{
|
||||
"compilerOptions": {
|
||||
"baseUrl": "./src",
|
||||
"paths": {
|
||||
"*1*": [ "*2*" ]
|
||||
~~~~~
|
||||
!!! error TS5061: Pattern '*1*' can have at most one '*' character
|
||||
~~~~~
|
||||
!!! error TS5062: Substitution '*2*' in pattern '*1*' in can have at most one '*' character
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
==== tests/cases/compiler/root/src/folder1/file1.ts (0 errors) ====
|
||||
export var x = 1;
|
||||
+10
@@ -1,6 +1,16 @@
|
||||
/a.ts(2,21): error TS2307: Cannot find module 'foo'.
|
||||
|
||||
|
||||
==== /tsconfig.json (0 errors) ====
|
||||
{
|
||||
"compilerOptions": {
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"foo": ["foo/foo.ts"]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
==== /a.ts (1 errors) ====
|
||||
|
||||
import { foo } from "foo";
|
||||
|
||||
@@ -1,6 +1,16 @@
|
||||
error TS5063: Substitutions for pattern '*' should be an array.
|
||||
tests/cases/compiler/tsconfig.json(5,18): error TS5063: Substitutions for pattern '*' should be an array.
|
||||
|
||||
|
||||
==== tests/cases/compiler/tsconfig.json (1 errors) ====
|
||||
{
|
||||
"compilerOptions": {
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"*": "*"
|
||||
~~~
|
||||
!!! error TS5063: Substitutions for pattern '*' should be an array.
|
||||
}
|
||||
}
|
||||
}
|
||||
==== tests/cases/compiler/a.ts (0 errors) ====
|
||||
let x = 1;
|
||||
@@ -1,6 +1,16 @@
|
||||
error TS5064: Substitution '1' for pattern '*' has incorrect type, expected 'string', got 'number'.
|
||||
tests/cases/compiler/tsconfig.json(5,19): error TS5064: Substitution '1' for pattern '*' has incorrect type, expected 'string', got 'number'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/tsconfig.json (1 errors) ====
|
||||
{
|
||||
"compilerOptions": {
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"*": [1]
|
||||
~
|
||||
!!! error TS5064: Substitution '1' for pattern '*' has incorrect type, expected 'string', got 'number'.
|
||||
}
|
||||
}
|
||||
}
|
||||
==== tests/cases/compiler/a.ts (0 errors) ====
|
||||
let x = 1;
|
||||
@@ -1,6 +1,17 @@
|
||||
error TS5066: Substitutions for pattern 'foo' shouldn't be an empty array.
|
||||
tests/cases/compiler/tsconfig.json(5,20): error TS5066: Substitutions for pattern 'foo' shouldn't be an empty array.
|
||||
|
||||
|
||||
==== tests/cases/compiler/tsconfig.json (1 errors) ====
|
||||
{
|
||||
"compilerOptions": {
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"foo": []
|
||||
~~
|
||||
!!! error TS5066: Substitutions for pattern 'foo' shouldn't be an empty array.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
==== tests/cases/compiler/a.ts (0 errors) ====
|
||||
let x = 1;
|
||||
+14
@@ -1,6 +1,20 @@
|
||||
main.ts(1,21): error TS2307: Cannot find module 'angular2/core'.
|
||||
|
||||
|
||||
==== tsconfig.json (0 errors) ====
|
||||
{
|
||||
"compileOnSave": true,
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"module": "commonjs",
|
||||
"emitDecoratorMetadata": true,
|
||||
"experimentalDecorators": true,
|
||||
"isolatedModules": true
|
||||
},
|
||||
"files": [
|
||||
"main.ts"
|
||||
]
|
||||
}
|
||||
==== main.ts (1 errors) ====
|
||||
import * as ng from "angular2/core";
|
||||
~~~~~~~~~~~~~~~
|
||||
|
||||
+14
@@ -1,6 +1,20 @@
|
||||
main.ts(1,21): error TS2307: Cannot find module 'angular2/core'.
|
||||
|
||||
|
||||
==== tsconfig.json (0 errors) ====
|
||||
{
|
||||
"compileOnSave": true,
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"module": "commonjs",
|
||||
"emitDecoratorMetadata": true,
|
||||
"experimentalDecorators": true,
|
||||
"isolatedModules": true
|
||||
},
|
||||
"files": [
|
||||
"main.ts"
|
||||
]
|
||||
}
|
||||
==== main.ts (1 errors) ====
|
||||
import * as ng from "angular2/core";
|
||||
~~~~~~~~~~~~~~~
|
||||
|
||||
+15
@@ -1,6 +1,21 @@
|
||||
main.ts(1,21): error TS2307: Cannot find module 'angular2/core'.
|
||||
|
||||
|
||||
==== tsconfig.json (0 errors) ====
|
||||
{
|
||||
"compileOnSave": true,
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"module": "commonjs",
|
||||
"emitDecoratorMetadata": true,
|
||||
"experimentalDecorators": true,
|
||||
"isolatedModules": true,
|
||||
"noResolve": true
|
||||
},
|
||||
"files": [
|
||||
"main.ts"
|
||||
]
|
||||
}
|
||||
==== main.ts (1 errors) ====
|
||||
import * as ng from "angular2/core";
|
||||
~~~~~~~~~~~~~~~
|
||||
|
||||
+15
@@ -1,6 +1,21 @@
|
||||
main.ts(1,21): error TS2307: Cannot find module 'angular2/core'.
|
||||
|
||||
|
||||
==== tsconfig.json (0 errors) ====
|
||||
{
|
||||
"compileOnSave": true,
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"module": "commonjs",
|
||||
"emitDecoratorMetadata": true,
|
||||
"experimentalDecorators": true,
|
||||
"isolatedModules": true,
|
||||
"noResolve": true
|
||||
},
|
||||
"files": [
|
||||
"main.ts"
|
||||
]
|
||||
}
|
||||
==== main.ts (1 errors) ====
|
||||
import * as ng from "angular2/core";
|
||||
~~~~~~~~~~~~~~~
|
||||
|
||||
+13
@@ -1,6 +1,19 @@
|
||||
main.ts(1,21): error TS2307: Cannot find module 'angular2/core'.
|
||||
|
||||
|
||||
==== tsconfig.json (0 errors) ====
|
||||
{
|
||||
"compileOnSave": true,
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"module": "system",
|
||||
"emitDecoratorMetadata": true,
|
||||
"experimentalDecorators": true
|
||||
},
|
||||
"files": [
|
||||
"main.ts"
|
||||
]
|
||||
}
|
||||
==== main.ts (1 errors) ====
|
||||
import * as ng from "angular2/core";
|
||||
~~~~~~~~~~~~~~~
|
||||
|
||||
+13
@@ -1,6 +1,19 @@
|
||||
main.ts(1,21): error TS2307: Cannot find module 'angular2/core'.
|
||||
|
||||
|
||||
==== tsconfig.json (0 errors) ====
|
||||
{
|
||||
"compileOnSave": true,
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"module": "system",
|
||||
"emitDecoratorMetadata": true,
|
||||
"experimentalDecorators": true
|
||||
},
|
||||
"files": [
|
||||
"main.ts"
|
||||
]
|
||||
}
|
||||
==== main.ts (1 errors) ====
|
||||
import * as ng from "angular2/core";
|
||||
~~~~~~~~~~~~~~~
|
||||
|
||||
+15
@@ -1,6 +1,21 @@
|
||||
main.ts(1,21): error TS2307: Cannot find module 'angular2/core'.
|
||||
|
||||
|
||||
==== tsconfig.json (0 errors) ====
|
||||
{
|
||||
"compileOnSave": true,
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"module": "system",
|
||||
"moduleResolution": "node",
|
||||
"emitDecoratorMetadata": true,
|
||||
"experimentalDecorators": true,
|
||||
"isolatedModules": true
|
||||
},
|
||||
"files": [
|
||||
"main.ts"
|
||||
]
|
||||
}
|
||||
==== main.ts (1 errors) ====
|
||||
import * as ng from "angular2/core";
|
||||
~~~~~~~~~~~~~~~
|
||||
|
||||
+15
@@ -1,6 +1,21 @@
|
||||
main.ts(1,21): error TS2307: Cannot find module 'angular2/core'.
|
||||
|
||||
|
||||
==== tsconfig.json (0 errors) ====
|
||||
{
|
||||
"compileOnSave": true,
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"module": "system",
|
||||
"moduleResolution": "node",
|
||||
"emitDecoratorMetadata": true,
|
||||
"experimentalDecorators": true,
|
||||
"isolatedModules": true
|
||||
},
|
||||
"files": [
|
||||
"main.ts"
|
||||
]
|
||||
}
|
||||
==== main.ts (1 errors) ====
|
||||
import * as ng from "angular2/core";
|
||||
~~~~~~~~~~~~~~~
|
||||
|
||||
+16
@@ -1,6 +1,22 @@
|
||||
main.ts(1,21): error TS2307: Cannot find module 'angular2/core'.
|
||||
|
||||
|
||||
==== tsconfig.json (0 errors) ====
|
||||
{
|
||||
"compileOnSave": true,
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"module": "system",
|
||||
"moduleResolution": "node",
|
||||
"emitDecoratorMetadata": true,
|
||||
"experimentalDecorators": true,
|
||||
"isolatedModules": true,
|
||||
"noResolve": true
|
||||
},
|
||||
"files": [
|
||||
"main.ts"
|
||||
]
|
||||
}
|
||||
==== main.ts (1 errors) ====
|
||||
import * as ng from "angular2/core";
|
||||
~~~~~~~~~~~~~~~
|
||||
|
||||
+16
@@ -1,6 +1,22 @@
|
||||
main.ts(1,21): error TS2307: Cannot find module 'angular2/core'.
|
||||
|
||||
|
||||
==== tsconfig.json (0 errors) ====
|
||||
{
|
||||
"compileOnSave": true,
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"module": "system",
|
||||
"moduleResolution": "node",
|
||||
"emitDecoratorMetadata": true,
|
||||
"experimentalDecorators": true,
|
||||
"isolatedModules": true,
|
||||
"noResolve": true
|
||||
},
|
||||
"files": [
|
||||
"main.ts"
|
||||
]
|
||||
}
|
||||
==== main.ts (1 errors) ====
|
||||
import * as ng from "angular2/core";
|
||||
~~~~~~~~~~~~~~~
|
||||
|
||||
+6
-1
@@ -1,6 +1,11 @@
|
||||
error TS6082: Only 'amd' and 'system' modules are supported alongside --out.
|
||||
DifferentNamesNotSpecified/tsconfig.json(2,24): error TS6082: Only 'amd' and 'system' modules are supported alongside --out.
|
||||
|
||||
|
||||
==== DifferentNamesNotSpecified/tsconfig.json (1 errors) ====
|
||||
{
|
||||
"compilerOptions": { "out": "test.js" }
|
||||
~~~~~
|
||||
!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --out.
|
||||
}
|
||||
==== DifferentNamesNotSpecified/a.ts (0 errors) ====
|
||||
var test = 10;
|
||||
+9
-1
@@ -1,7 +1,15 @@
|
||||
error TS5053: Option 'allowJs' cannot be specified with option 'declaration'.
|
||||
DifferentNamesNotSpecifiedWithAllowJs/tsconfig.json(4,5): error TS5053: Option 'allowJs' cannot be specified with option 'declaration'.
|
||||
|
||||
|
||||
==== DifferentNamesNotSpecifiedWithAllowJs/tsconfig.json (1 errors) ====
|
||||
{
|
||||
"compilerOptions": {
|
||||
"out": "test.js",
|
||||
"allowJs": true
|
||||
~~~~~~~~~
|
||||
!!! error TS5053: Option 'allowJs' cannot be specified with option 'declaration'.
|
||||
}
|
||||
}
|
||||
==== DifferentNamesNotSpecifiedWithAllowJs/a.ts (0 errors) ====
|
||||
var test = 10;
|
||||
==== DifferentNamesNotSpecifiedWithAllowJs/b.js (0 errors) ====
|
||||
|
||||
+12
-3
@@ -1,9 +1,18 @@
|
||||
error TS5053: Option 'allowJs' cannot be specified with option 'declaration'.
|
||||
error TS6082: Only 'amd' and 'system' modules are supported alongside --out.
|
||||
DifferentNamesNotSpecifiedWithAllowJs/tsconfig.json(3,5): error TS6082: Only 'amd' and 'system' modules are supported alongside --out.
|
||||
DifferentNamesNotSpecifiedWithAllowJs/tsconfig.json(4,5): error TS5053: Option 'allowJs' cannot be specified with option 'declaration'.
|
||||
|
||||
|
||||
!!! error TS5053: Option 'allowJs' cannot be specified with option 'declaration'.
|
||||
==== DifferentNamesNotSpecifiedWithAllowJs/tsconfig.json (2 errors) ====
|
||||
{
|
||||
"compilerOptions": {
|
||||
"out": "test.js",
|
||||
~~~~~
|
||||
!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --out.
|
||||
"allowJs": true
|
||||
~~~~~~~~~
|
||||
!!! error TS5053: Option 'allowJs' cannot be specified with option 'declaration'.
|
||||
}
|
||||
}
|
||||
==== DifferentNamesNotSpecifiedWithAllowJs/a.ts (0 errors) ====
|
||||
var test = 10;
|
||||
==== DifferentNamesNotSpecifiedWithAllowJs/b.js (0 errors) ====
|
||||
|
||||
+5
@@ -2,5 +2,10 @@ error TS6054: File 'DifferentNamesSpecified/b.js' has unsupported extension. The
|
||||
|
||||
|
||||
!!! error TS6054: File 'DifferentNamesSpecified/b.js' has unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts'.
|
||||
==== DifferentNamesSpecified/tsconfig.json (0 errors) ====
|
||||
{
|
||||
"compilerOptions": { "out": "test.js" },
|
||||
"files": [ "a.ts", "b.js" ]
|
||||
}
|
||||
==== DifferentNamesSpecified/a.ts (0 errors) ====
|
||||
var test = 10;
|
||||
+7
-1
@@ -1,8 +1,14 @@
|
||||
error TS6054: File 'DifferentNamesSpecified/b.js' has unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts'.
|
||||
error TS6082: Only 'amd' and 'system' modules are supported alongside --out.
|
||||
DifferentNamesSpecified/tsconfig.json(2,24): error TS6082: Only 'amd' and 'system' modules are supported alongside --out.
|
||||
|
||||
|
||||
!!! error TS6054: File 'DifferentNamesSpecified/b.js' has unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts'.
|
||||
==== DifferentNamesSpecified/tsconfig.json (1 errors) ====
|
||||
{
|
||||
"compilerOptions": { "out": "test.js" },
|
||||
~~~~~
|
||||
!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --out.
|
||||
"files": [ "a.ts", "b.js" ]
|
||||
}
|
||||
==== DifferentNamesSpecified/a.ts (0 errors) ====
|
||||
var test = 10;
|
||||
+10
-1
@@ -1,7 +1,16 @@
|
||||
error TS5053: Option 'allowJs' cannot be specified with option 'declaration'.
|
||||
DifferentNamesSpecifiedWithAllowJs/tsconfig.json(4,5): error TS5053: Option 'allowJs' cannot be specified with option 'declaration'.
|
||||
|
||||
|
||||
==== DifferentNamesSpecifiedWithAllowJs/tsconfig.json (1 errors) ====
|
||||
{
|
||||
"compilerOptions": {
|
||||
"out": "test.js",
|
||||
"allowJs": true
|
||||
~~~~~~~~~
|
||||
!!! error TS5053: Option 'allowJs' cannot be specified with option 'declaration'.
|
||||
},
|
||||
"files": [ "a.ts", "b.js" ]
|
||||
}
|
||||
==== DifferentNamesSpecifiedWithAllowJs/a.ts (0 errors) ====
|
||||
var test = 10;
|
||||
==== DifferentNamesSpecifiedWithAllowJs/b.js (0 errors) ====
|
||||
|
||||
+13
-3
@@ -1,9 +1,19 @@
|
||||
error TS5053: Option 'allowJs' cannot be specified with option 'declaration'.
|
||||
error TS6082: Only 'amd' and 'system' modules are supported alongside --out.
|
||||
DifferentNamesSpecifiedWithAllowJs/tsconfig.json(3,5): error TS6082: Only 'amd' and 'system' modules are supported alongside --out.
|
||||
DifferentNamesSpecifiedWithAllowJs/tsconfig.json(4,5): error TS5053: Option 'allowJs' cannot be specified with option 'declaration'.
|
||||
|
||||
|
||||
!!! error TS5053: Option 'allowJs' cannot be specified with option 'declaration'.
|
||||
==== DifferentNamesSpecifiedWithAllowJs/tsconfig.json (2 errors) ====
|
||||
{
|
||||
"compilerOptions": {
|
||||
"out": "test.js",
|
||||
~~~~~
|
||||
!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --out.
|
||||
"allowJs": true
|
||||
~~~~~~~~~
|
||||
!!! error TS5053: Option 'allowJs' cannot be specified with option 'declaration'.
|
||||
},
|
||||
"files": [ "a.ts", "b.js" ]
|
||||
}
|
||||
==== DifferentNamesSpecifiedWithAllowJs/a.ts (0 errors) ====
|
||||
var test = 10;
|
||||
==== DifferentNamesSpecifiedWithAllowJs/b.js (0 errors) ====
|
||||
|
||||
+7
-1
@@ -1,6 +1,12 @@
|
||||
error TS5053: Option 'allowJs' cannot be specified with option 'declaration'.
|
||||
SameNameDTsSpecifiedWithAllowJs/tsconfig.json(2,24): error TS5053: Option 'allowJs' cannot be specified with option 'declaration'.
|
||||
|
||||
|
||||
==== SameNameDTsSpecifiedWithAllowJs/tsconfig.json (1 errors) ====
|
||||
{
|
||||
"compilerOptions": { "allowJs": true },
|
||||
~~~~~~~~~
|
||||
!!! error TS5053: Option 'allowJs' cannot be specified with option 'declaration'.
|
||||
"files": [ "a.d.ts" ]
|
||||
}
|
||||
==== SameNameDTsSpecifiedWithAllowJs/a.d.ts (0 errors) ====
|
||||
declare var test: number;
|
||||
+7
-1
@@ -1,6 +1,12 @@
|
||||
error TS5053: Option 'allowJs' cannot be specified with option 'declaration'.
|
||||
SameNameDTsSpecifiedWithAllowJs/tsconfig.json(2,24): error TS5053: Option 'allowJs' cannot be specified with option 'declaration'.
|
||||
|
||||
|
||||
==== SameNameDTsSpecifiedWithAllowJs/tsconfig.json (1 errors) ====
|
||||
{
|
||||
"compilerOptions": { "allowJs": true },
|
||||
~~~~~~~~~
|
||||
!!! error TS5053: Option 'allowJs' cannot be specified with option 'declaration'.
|
||||
"files": [ "a.d.ts" ]
|
||||
}
|
||||
==== SameNameDTsSpecifiedWithAllowJs/a.d.ts (0 errors) ====
|
||||
declare var test: number;
|
||||
+5
-2
@@ -1,11 +1,14 @@
|
||||
error TS5053: Option 'allowJs' cannot be specified with option 'declaration'.
|
||||
error TS5055: Cannot write file 'SameNameDTsNotSpecifiedWithAllowJs/a.js' because it would overwrite input file.
|
||||
Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig
|
||||
SameNameDTsNotSpecifiedWithAllowJs/tsconfig.json(1,24): error TS5053: Option 'allowJs' cannot be specified with option 'declaration'.
|
||||
|
||||
|
||||
!!! error TS5053: Option 'allowJs' cannot be specified with option 'declaration'.
|
||||
!!! error TS5055: Cannot write file 'SameNameDTsNotSpecifiedWithAllowJs/a.js' because it would overwrite input file.
|
||||
!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig
|
||||
==== SameNameDTsNotSpecifiedWithAllowJs/tsconfig.json (1 errors) ====
|
||||
{ "compilerOptions": { "allowJs": true } }
|
||||
~~~~~~~~~
|
||||
!!! error TS5053: Option 'allowJs' cannot be specified with option 'declaration'.
|
||||
==== SameNameDTsNotSpecifiedWithAllowJs/a.d.ts (0 errors) ====
|
||||
declare var a: number;
|
||||
==== SameNameDTsNotSpecifiedWithAllowJs/a.js (0 errors) ====
|
||||
|
||||
+5
-2
@@ -1,11 +1,14 @@
|
||||
error TS5053: Option 'allowJs' cannot be specified with option 'declaration'.
|
||||
error TS5055: Cannot write file 'SameNameDTsNotSpecifiedWithAllowJs/a.js' because it would overwrite input file.
|
||||
Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig
|
||||
SameNameDTsNotSpecifiedWithAllowJs/tsconfig.json(1,24): error TS5053: Option 'allowJs' cannot be specified with option 'declaration'.
|
||||
|
||||
|
||||
!!! error TS5053: Option 'allowJs' cannot be specified with option 'declaration'.
|
||||
!!! error TS5055: Cannot write file 'SameNameDTsNotSpecifiedWithAllowJs/a.js' because it would overwrite input file.
|
||||
!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig
|
||||
==== SameNameDTsNotSpecifiedWithAllowJs/tsconfig.json (1 errors) ====
|
||||
{ "compilerOptions": { "allowJs": true } }
|
||||
~~~~~~~~~
|
||||
!!! error TS5053: Option 'allowJs' cannot be specified with option 'declaration'.
|
||||
==== SameNameDTsNotSpecifiedWithAllowJs/a.d.ts (0 errors) ====
|
||||
declare var a: number;
|
||||
==== SameNameDTsNotSpecifiedWithAllowJs/a.js (0 errors) ====
|
||||
|
||||
+4
-1
@@ -1,6 +1,9 @@
|
||||
error TS5053: Option 'allowJs' cannot be specified with option 'declaration'.
|
||||
SameNameFilesNotSpecifiedWithAllowJs/tsconfig.json(1,24): error TS5053: Option 'allowJs' cannot be specified with option 'declaration'.
|
||||
|
||||
|
||||
==== SameNameFilesNotSpecifiedWithAllowJs/tsconfig.json (1 errors) ====
|
||||
{ "compilerOptions": { "allowJs": true } }
|
||||
~~~~~~~~~
|
||||
!!! error TS5053: Option 'allowJs' cannot be specified with option 'declaration'.
|
||||
==== SameNameFilesNotSpecifiedWithAllowJs/a.ts (0 errors) ====
|
||||
var test = 10;
|
||||
+4
-1
@@ -1,6 +1,9 @@
|
||||
error TS5053: Option 'allowJs' cannot be specified with option 'declaration'.
|
||||
SameNameFilesNotSpecifiedWithAllowJs/tsconfig.json(1,24): error TS5053: Option 'allowJs' cannot be specified with option 'declaration'.
|
||||
|
||||
|
||||
==== SameNameFilesNotSpecifiedWithAllowJs/tsconfig.json (1 errors) ====
|
||||
{ "compilerOptions": { "allowJs": true } }
|
||||
~~~~~~~~~
|
||||
!!! error TS5053: Option 'allowJs' cannot be specified with option 'declaration'.
|
||||
==== SameNameFilesNotSpecifiedWithAllowJs/a.ts (0 errors) ====
|
||||
var test = 10;
|
||||
+7
-1
@@ -1,6 +1,12 @@
|
||||
error TS5053: Option 'allowJs' cannot be specified with option 'declaration'.
|
||||
SameNameTsSpecifiedWithAllowJs/tsconfig.json(2,24): error TS5053: Option 'allowJs' cannot be specified with option 'declaration'.
|
||||
|
||||
|
||||
==== SameNameTsSpecifiedWithAllowJs/tsconfig.json (1 errors) ====
|
||||
{
|
||||
"compilerOptions": { "allowJs": true },
|
||||
~~~~~~~~~
|
||||
!!! error TS5053: Option 'allowJs' cannot be specified with option 'declaration'.
|
||||
"files": [ "a.ts" ]
|
||||
}
|
||||
==== SameNameTsSpecifiedWithAllowJs/a.ts (0 errors) ====
|
||||
var test = 10;
|
||||
+7
-1
@@ -1,6 +1,12 @@
|
||||
error TS5053: Option 'allowJs' cannot be specified with option 'declaration'.
|
||||
SameNameTsSpecifiedWithAllowJs/tsconfig.json(2,24): error TS5053: Option 'allowJs' cannot be specified with option 'declaration'.
|
||||
|
||||
|
||||
==== SameNameTsSpecifiedWithAllowJs/tsconfig.json (1 errors) ====
|
||||
{
|
||||
"compilerOptions": { "allowJs": true },
|
||||
~~~~~~~~~
|
||||
!!! error TS5053: Option 'allowJs' cannot be specified with option 'declaration'.
|
||||
"files": [ "a.ts" ]
|
||||
}
|
||||
==== SameNameTsSpecifiedWithAllowJs/a.ts (0 errors) ====
|
||||
var test = 10;
|
||||
+10
@@ -1,6 +1,16 @@
|
||||
importHigher/root.ts(6,1): error TS2322: Type '"10"' is not assignable to type 'number'.
|
||||
|
||||
|
||||
==== importHigher/tsconfig.json (0 errors) ====
|
||||
{
|
||||
"compilerOptions": {
|
||||
"allowJs": true,
|
||||
"declaration": false,
|
||||
"moduleResolution": "node",
|
||||
"maxNodeModuleJsDepth": 2
|
||||
}
|
||||
}
|
||||
|
||||
==== entry.js (0 errors) ====
|
||||
var m3 = require("m3");
|
||||
|
||||
|
||||
+10
@@ -1,6 +1,16 @@
|
||||
importHigher/root.ts(6,1): error TS2322: Type '"10"' is not assignable to type 'number'.
|
||||
|
||||
|
||||
==== importHigher/tsconfig.json (0 errors) ====
|
||||
{
|
||||
"compilerOptions": {
|
||||
"allowJs": true,
|
||||
"declaration": false,
|
||||
"moduleResolution": "node",
|
||||
"maxNodeModuleJsDepth": 2
|
||||
}
|
||||
}
|
||||
|
||||
==== entry.js (0 errors) ====
|
||||
var m3 = require("m3");
|
||||
|
||||
|
||||
+11
@@ -2,6 +2,17 @@ maxDepthExceeded/root.ts(3,1): error TS2322: Type '"10"' is not assignable to ty
|
||||
maxDepthExceeded/root.ts(4,4): error TS2540: Cannot assign to 'rel' because it is a constant or a read-only property.
|
||||
|
||||
|
||||
==== maxDepthExceeded/tsconfig.json (0 errors) ====
|
||||
{
|
||||
"compilerOptions": {
|
||||
"allowJs": true,
|
||||
"maxNodeModuleJsDepth": 1, // Note: Module m1 is already included as a root file
|
||||
"outDir": "built"
|
||||
},
|
||||
"include": ["**/*"],
|
||||
"exclude": ["node_modules/m2/**/*"]
|
||||
}
|
||||
|
||||
==== entry.js (0 errors) ====
|
||||
var m3 = require("m3");
|
||||
|
||||
|
||||
+11
@@ -2,6 +2,17 @@ maxDepthExceeded/root.ts(3,1): error TS2322: Type '"10"' is not assignable to ty
|
||||
maxDepthExceeded/root.ts(4,4): error TS2540: Cannot assign to 'rel' because it is a constant or a read-only property.
|
||||
|
||||
|
||||
==== maxDepthExceeded/tsconfig.json (0 errors) ====
|
||||
{
|
||||
"compilerOptions": {
|
||||
"allowJs": true,
|
||||
"maxNodeModuleJsDepth": 1, // Note: Module m1 is already included as a root file
|
||||
"outDir": "built"
|
||||
},
|
||||
"include": ["**/*"],
|
||||
"exclude": ["node_modules/m2/**/*"]
|
||||
}
|
||||
|
||||
==== entry.js (0 errors) ====
|
||||
var m3 = require("m3");
|
||||
|
||||
|
||||
+8
@@ -1,6 +1,14 @@
|
||||
maxDepthIncreased/root.ts(7,1): error TS2322: Type '"10"' is not assignable to type 'number'.
|
||||
|
||||
|
||||
==== maxDepthIncreased/tsconfig.json (0 errors) ====
|
||||
{
|
||||
"compilerOptions": {
|
||||
"allowJs": true,
|
||||
"maxNodeModuleJsDepth": 3
|
||||
}
|
||||
}
|
||||
|
||||
==== index.js (0 errors) ====
|
||||
exports.person = {
|
||||
"name": "John Doe",
|
||||
|
||||
+8
@@ -1,6 +1,14 @@
|
||||
maxDepthIncreased/root.ts(7,1): error TS2322: Type '"10"' is not assignable to type 'number'.
|
||||
|
||||
|
||||
==== maxDepthIncreased/tsconfig.json (0 errors) ====
|
||||
{
|
||||
"compilerOptions": {
|
||||
"allowJs": true,
|
||||
"maxNodeModuleJsDepth": 3
|
||||
}
|
||||
}
|
||||
|
||||
==== index.js (0 errors) ====
|
||||
exports.person = {
|
||||
"name": "John Doe",
|
||||
|
||||
Reference in New Issue
Block a user