diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 4103693d03d..3f1474f5d0c 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -298,6 +298,7 @@ namespace ts { let typeCount = 0; let symbolCount = 0; let enumCount = 0; + let totalInstantiationCount = 0; let instantiationCount = 0; let instantiationDepth = 0; let constraintDepth = 0; @@ -348,6 +349,7 @@ namespace ts { getIdentifierCount: () => sum(host.getSourceFiles(), "identifierCount"), getSymbolCount: () => sum(host.getSourceFiles(), "symbolCount") + symbolCount, getTypeCount: () => typeCount, + getInstantiationCount: () => totalInstantiationCount, getRelationCacheSizes: () => ({ assignable: assignableRelation.size, identity: identityRelation.size, @@ -13775,6 +13777,7 @@ namespace ts { error(currentNode, Diagnostics.Type_instantiation_is_excessively_deep_and_possibly_infinite); return errorType; } + totalInstantiationCount++; instantiationCount++; instantiationDepth++; const result = instantiateTypeWorker(type, mapper); @@ -20519,12 +20522,20 @@ namespace ts { /** remove undefined from the annotated type of a parameter when there is an initializer (that doesn't include undefined) */ function removeOptionalityFromDeclaredType(declaredType: Type, declaration: VariableLikeDeclaration): Type { - const annotationIncludesUndefined = strictNullChecks && - declaration.kind === SyntaxKind.Parameter && - declaration.initializer && - getFalsyFlags(declaredType) & TypeFlags.Undefined && - !(getFalsyFlags(checkExpression(declaration.initializer)) & TypeFlags.Undefined); - return annotationIncludesUndefined ? getTypeWithFacts(declaredType, TypeFacts.NEUndefined) : declaredType; + if (pushTypeResolution(declaration.symbol, TypeSystemPropertyName.DeclaredType)) { + const annotationIncludesUndefined = strictNullChecks && + declaration.kind === SyntaxKind.Parameter && + declaration.initializer && + getFalsyFlags(declaredType) & TypeFlags.Undefined && + !(getFalsyFlags(checkExpression(declaration.initializer)) & TypeFlags.Undefined); + popTypeResolution(); + + return annotationIncludesUndefined ? getTypeWithFacts(declaredType, TypeFacts.NEUndefined) : declaredType; + } + else { + reportCircularityError(declaration.symbol); + return declaredType; + } } function isConstraintPosition(node: Node) { @@ -20947,7 +20958,7 @@ namespace ts { break; case SyntaxKind.PropertyDeclaration: case SyntaxKind.PropertySignature: - if (hasModifier(container, ModifierFlags.Static)) { + if (hasModifier(container, ModifierFlags.Static) && !(compilerOptions.target === ScriptTarget.ESNext && compilerOptions.useDefineForClassFields)) { error(node, Diagnostics.this_cannot_be_referenced_in_a_static_property_initializer); // do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks } diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index e425445fc32..72bc87d4eee 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -1164,11 +1164,13 @@ namespace ts { } } - interface OptionsBase { + /*@internal*/ + export interface OptionsBase { [option: string]: CompilerOptionsValue | TsConfigSourceFile | undefined; } - interface ParseCommandLineWorkerDiagnostics extends DidYouMeanOptionsDiagnostics { + /*@internal*/ + export interface ParseCommandLineWorkerDiagnostics extends DidYouMeanOptionsDiagnostics { getOptionsNameMap: () => OptionsNameMap; optionTypeMismatchDiagnostic: DiagnosticMessage; } @@ -1189,7 +1191,8 @@ namespace ts { createDiagnostics(diagnostics.unknownOptionDiagnostic, unknownOptionErrorText || unknownOption); } - function parseCommandLineWorker( + /*@internal*/ + export function parseCommandLineWorker( diagnostics: ParseCommandLineWorkerDiagnostics, commandLine: readonly string[], readFile?: (path: string) => string | undefined) { @@ -1279,7 +1282,25 @@ namespace ts { errors: Diagnostic[] ) { if (opt.isTSConfigOnly) { - errors.push(createCompilerDiagnostic(Diagnostics.Option_0_can_only_be_specified_in_tsconfig_json_file, opt.name)); + const optValue = args[i]; + if (optValue === "null") { + options[opt.name] = undefined; + i++; + } + else if (opt.type === "boolean") { + if (optValue === "false") { + options[opt.name] = false; + i++; + } + else { + if (optValue === "true") i++; + errors.push(createCompilerDiagnostic(Diagnostics.Option_0_can_only_be_specified_in_tsconfig_json_file_or_set_to_false_or_null_on_command_line, opt.name)); + } + } + else { + errors.push(createCompilerDiagnostic(Diagnostics.Option_0_can_only_be_specified_in_tsconfig_json_file_or_set_to_null_on_command_line, opt.name)); + if (optValue && !startsWith(optValue, "-")) i++; + } } else { // Check to see if no argument was provided (e.g. "--locale" is the last command-line argument). @@ -1287,42 +1308,49 @@ namespace ts { errors.push(createCompilerDiagnostic(diagnostics.optionTypeMismatchDiagnostic, opt.name, getCompilerOptionValueTypeString(opt))); } - switch (opt.type) { - case "number": - options[opt.name] = parseInt(args[i]); - i++; - break; - case "boolean": - // boolean flag has optional value true, false, others - const optValue = args[i]; - options[opt.name] = optValue !== "false"; - // consume next argument as boolean flag value - if (optValue === "false" || optValue === "true") { + if (args[i] !== "null") { + switch (opt.type) { + case "number": + options[opt.name] = parseInt(args[i]); i++; - } - break; - case "string": - options[opt.name] = args[i] || ""; - i++; - break; - case "list": - const result = parseListTypeOption(opt, args[i], errors); - options[opt.name] = result || []; - if (result) { + break; + case "boolean": + // boolean flag has optional value true, false, others + const optValue = args[i]; + options[opt.name] = optValue !== "false"; + // consume next argument as boolean flag value + if (optValue === "false" || optValue === "true") { + i++; + } + break; + case "string": + options[opt.name] = args[i] || ""; i++; - } - break; - // If not a primitive, the possible types are specified in what is effectively a map of options. - default: - options[opt.name] = parseCustomTypeOption(opt, args[i], errors); - i++; - break; + break; + case "list": + const result = parseListTypeOption(opt, args[i], errors); + options[opt.name] = result || []; + if (result) { + i++; + } + break; + // If not a primitive, the possible types are specified in what is effectively a map of options. + default: + options[opt.name] = parseCustomTypeOption(opt, args[i], errors); + i++; + break; + } + } + else { + options[opt.name] = undefined; + i++; } } return i; } - const compilerOptionsDidYouMeanDiagnostics: ParseCommandLineWorkerDiagnostics = { + /*@internal*/ + export const compilerOptionsDidYouMeanDiagnostics: ParseCommandLineWorkerDiagnostics = { getOptionsNameMap, optionDeclarations, unknownOptionDiagnostic: Diagnostics.Unknown_compiler_option_0, @@ -2170,7 +2198,7 @@ namespace ts { } function convertToOptionValueWithAbsolutePaths(option: CommandLineOption | undefined, value: CompilerOptionsValue, toAbsolutePath: (path: string) => string) { - if (option) { + if (option && !isNullOrUndefined(value)) { if (option.type === "list") { const values = value as readonly (string | number)[]; if (option.element.isFilePath && values.length) { diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 4ee407ce1c1..d64e8d6ee80 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -3642,7 +3642,7 @@ "category": "Message", "code": 6061 }, - "Option '{0}' can only be specified in 'tsconfig.json' file.": { + "Option '{0}' can only be specified in 'tsconfig.json' file or set to 'null' on command line.": { "category": "Error", "code": 6064 }, @@ -4296,6 +4296,10 @@ "category": "Error", "code": 6229 }, + "Option '{0}' can only be specified in 'tsconfig.json' file or set to 'false' or 'null' on command line.": { + "category": "Error", + "code": 6230 + }, "Projects to reference": { "category": "Message", diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 4675ae8493d..3519e07ab46 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -946,6 +946,7 @@ namespace ts { getIdentifierCount: () => getDiagnosticsProducingTypeChecker().getIdentifierCount(), getSymbolCount: () => getDiagnosticsProducingTypeChecker().getSymbolCount(), getTypeCount: () => getDiagnosticsProducingTypeChecker().getTypeCount(), + getInstantiationCount: () => getDiagnosticsProducingTypeChecker().getInstantiationCount(), getRelationCacheSizes: () => getDiagnosticsProducingTypeChecker().getRelationCacheSizes(), getFileProcessingDiagnostics: () => fileProcessingDiagnostics, getResolvedTypeReferenceDirectives: () => resolvedTypeReferenceDirectives, diff --git a/src/compiler/transformers/module/module.ts b/src/compiler/transformers/module/module.ts index 895be21f988..62cbb4b6207 100644 --- a/src/compiler/transformers/module/module.ts +++ b/src/compiler/transformers/module/module.ts @@ -1180,7 +1180,6 @@ namespace ts { let modifiers: NodeArray | undefined; // If we're exporting these variables, then these just become assignments to 'exports.x'. - // We only want to emit assignments for variables with initializers. for (const variable of node.declarationList.declarations) { if (isIdentifier(variable.name) && isLocalName(variable.name)) { if (!modifiers) { @@ -1189,7 +1188,7 @@ namespace ts { variables = append(variables, variable); } - else if (variable.initializer) { + else { expressions = append(expressions, transformInitializedVariable(variable)); } } @@ -1259,7 +1258,7 @@ namespace ts { ), /*location*/ node.name ), - visitNode(node.initializer, moduleExpressionElementVisitor) + node.initializer ? visitNode(node.initializer, moduleExpressionElementVisitor) : createVoidZero() ); } } diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 74cd04d7674..36c3f44268d 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -3235,6 +3235,7 @@ namespace ts { getIdentifierCount(): number; getSymbolCount(): number; getTypeCount(): number; + getInstantiationCount(): number; getRelationCacheSizes(): { assignable: number, identity: number, subtype: number, strictSubtype: number }; /* @internal */ getFileProcessingDiagnostics(): DiagnosticCollection; @@ -3557,6 +3558,7 @@ namespace ts { /* @internal */ getIdentifierCount(): number; /* @internal */ getSymbolCount(): number; /* @internal */ getTypeCount(): number; + /* @internal */ getInstantiationCount(): number; /* @internal */ getRelationCacheSizes(): { assignable: number, identity: number, subtype: number, strictSubtype: number }; /* @internal */ isArrayType(type: Type): boolean; diff --git a/src/executeCommandLine/executeCommandLine.ts b/src/executeCommandLine/executeCommandLine.ts index 6ce8e90a1df..e66b55d9b55 100644 --- a/src/executeCommandLine/executeCommandLine.ts +++ b/src/executeCommandLine/executeCommandLine.ts @@ -639,6 +639,7 @@ namespace ts { reportCountStatistic("Identifiers", program.getIdentifierCount()); reportCountStatistic("Symbols", program.getSymbolCount()); reportCountStatistic("Types", program.getTypeCount()); + reportCountStatistic("Instantiations", program.getInstantiationCount()); if (memoryUsed >= 0) { reportStatisticalValue("Memory used", Math.round(memoryUsed / 1000) + "K"); diff --git a/src/loc/lcl/trk/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/trk/diagnosticMessages/diagnosticMessages.generated.json.lcl index 1b79cea49e5..0a26fe3f277 100644 --- a/src/loc/lcl/trk/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/trk/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -44,12 +44,18 @@ + + + + + + @@ -92,6 +98,9 @@ + + + @@ -209,6 +218,9 @@ + + + @@ -224,6 +236,9 @@ + + + @@ -413,6 +428,9 @@ + + + @@ -428,6 +446,9 @@ + + + @@ -503,12 +524,18 @@ + + + + + + @@ -587,6 +614,9 @@ + + + @@ -641,12 +671,18 @@ + + + + + + @@ -770,8 +806,8 @@ - - + + @@ -827,6 +863,9 @@ + + + @@ -971,6 +1010,9 @@ + + + @@ -1004,18 +1046,27 @@ + + + + + + + + + @@ -1031,18 +1082,27 @@ + + + + + + + + + @@ -1067,6 +1127,9 @@ + + + @@ -1103,18 +1166,27 @@ + + + + + + + + + @@ -1142,6 +1214,9 @@ + + + @@ -1157,6 +1232,9 @@ + + + @@ -1208,12 +1286,18 @@ + + + + + + @@ -1283,6 +1367,9 @@ + + + @@ -1298,6 +1385,9 @@ + + + @@ -1313,6 +1403,9 @@ + + + @@ -1337,6 +1430,9 @@ + + + @@ -1379,12 +1475,18 @@ + + + + + + @@ -1409,24 +1511,36 @@ + + + + + + + + + + + + @@ -1478,6 +1592,9 @@ + + + @@ -1493,6 +1610,9 @@ + + + @@ -1553,6 +1673,9 @@ + + + @@ -1568,6 +1691,9 @@ + + + @@ -1583,12 +1709,18 @@ + + + + + + @@ -1712,6 +1844,9 @@ + + + @@ -1727,6 +1862,9 @@ + + + @@ -1787,12 +1925,18 @@ + + + + + + @@ -1844,12 +1988,18 @@ + + + + + + @@ -1895,12 +2045,18 @@ + + + + + + @@ -1952,6 +2108,9 @@ + + + @@ -1985,6 +2144,9 @@ + + + @@ -2036,6 +2198,9 @@ + + + @@ -2063,6 +2228,9 @@ + + + @@ -2078,6 +2246,9 @@ + + + @@ -2102,6 +2273,9 @@ + + + @@ -2126,12 +2300,18 @@ + + + + + + @@ -2183,6 +2363,9 @@ + + + @@ -2216,6 +2399,9 @@ + + + @@ -2279,6 +2465,9 @@ + + + @@ -2321,48 +2510,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + @@ -2450,18 +2663,27 @@ + + + + + + + + + @@ -2519,6 +2741,9 @@ + + + @@ -2561,6 +2786,9 @@ + + + @@ -2693,6 +2921,9 @@ + + + @@ -2819,6 +3050,9 @@ + + + @@ -2861,6 +3095,9 @@ + + + @@ -2876,6 +3113,9 @@ + + + @@ -2918,12 +3158,18 @@ + + + + + + @@ -2939,6 +3185,9 @@ + + + @@ -2990,6 +3239,9 @@ + + + @@ -3014,12 +3266,18 @@ + + + + + + @@ -3035,12 +3293,18 @@ + + + + + + @@ -3056,12 +3320,18 @@ + + + + + + @@ -3086,12 +3356,18 @@ + + + + + + @@ -3116,6 +3392,9 @@ + + + @@ -3140,12 +3419,18 @@ + + + + + + @@ -3161,18 +3446,27 @@ + + + + + + + + + @@ -3218,12 +3512,18 @@ + + + + + + @@ -3257,6 +3557,9 @@ + + + @@ -3338,12 +3641,18 @@ + + + + + + @@ -3395,42 +3704,63 @@ + + + + + + {1}'?]]> + + {1}' türüne kısıtlanmasını mı istediniz?]]> + + + + + + + + + + + + + @@ -3476,6 +3806,9 @@ + + + @@ -3491,6 +3824,9 @@ + + + @@ -3725,6 +4061,9 @@ + + + @@ -3767,24 +4106,36 @@ + + + + + + + + + + + + @@ -3809,6 +4160,9 @@ + + + @@ -3833,6 +4187,9 @@ + + + @@ -3875,6 +4232,9 @@ + + + @@ -3908,12 +4268,18 @@ + + + + + + @@ -4031,6 +4397,9 @@ + + + @@ -4145,6 +4514,9 @@ + + + @@ -4160,8 +4532,8 @@ - - + + @@ -4301,6 +4673,9 @@ + + + @@ -4388,24 +4763,36 @@ + + + + + + + + + + + + @@ -4466,6 +4853,9 @@ + + + @@ -4481,6 +4871,9 @@ + + + @@ -4496,6 +4889,9 @@ + + + @@ -4589,6 +4985,9 @@ + + + @@ -4730,6 +5129,9 @@ + + + @@ -4745,6 +5147,9 @@ + + + @@ -4778,6 +5183,9 @@ + + + @@ -4874,6 +5282,9 @@ + + + @@ -4919,6 +5330,9 @@ + + + @@ -4943,6 +5357,9 @@ + + + @@ -5012,6 +5429,9 @@ + + + @@ -5069,6 +5489,9 @@ + + + @@ -5207,6 +5630,9 @@ + + + @@ -5486,6 +5912,9 @@ + + + @@ -5615,6 +6044,9 @@ + + + @@ -5687,6 +6119,9 @@ + + + @@ -5867,6 +6302,9 @@ + + + @@ -5936,24 +6374,36 @@ + + + + + + + + + + + + @@ -5987,6 +6437,9 @@ + + + @@ -6011,6 +6464,9 @@ + + + @@ -6065,6 +6521,9 @@ + + + @@ -6107,6 +6566,9 @@ + + + @@ -6197,18 +6659,27 @@ + + + + + + + + + @@ -6224,24 +6695,36 @@ + + + + + + + + + + + + @@ -6266,12 +6749,18 @@ + + + + + + @@ -6287,12 +6776,18 @@ + + + + + + @@ -6308,6 +6803,9 @@ + + + @@ -6431,6 +6929,9 @@ + + + @@ -6512,6 +7013,9 @@ + + + @@ -6545,6 +7049,9 @@ + + + @@ -6596,6 +7103,9 @@ + + + @@ -6629,6 +7139,9 @@ + + + @@ -6689,6 +7202,9 @@ + + + @@ -6758,6 +7274,9 @@ + + + @@ -6773,18 +7292,27 @@ + + + + + + + + + @@ -6989,12 +7517,18 @@ + + + + + + @@ -7073,6 +7607,9 @@ + + + @@ -7088,6 +7625,9 @@ + + + @@ -7103,6 +7643,9 @@ + + + @@ -7127,6 +7670,9 @@ + + + @@ -7142,30 +7688,45 @@ + + + + + + + + + + + + + + + @@ -7181,6 +7742,9 @@ + + + @@ -7214,12 +7778,18 @@ + + + + + + @@ -7343,12 +7913,18 @@ + + + + + + @@ -7376,12 +7952,18 @@ + + + + + + @@ -7406,6 +7988,9 @@ + + + @@ -7421,12 +8006,18 @@ + + + + + + @@ -7505,6 +8096,9 @@ + + + @@ -7565,12 +8159,18 @@ + + + + + + @@ -7730,6 +8330,9 @@ + + + @@ -7754,6 +8357,9 @@ + + + @@ -7778,6 +8384,9 @@ + + + @@ -7829,18 +8438,27 @@ + + + + + + + + + @@ -7856,6 +8474,9 @@ + + + @@ -7880,6 +8501,9 @@ + + + @@ -7895,6 +8519,9 @@ + + + @@ -8078,12 +8705,18 @@ + + + + + + @@ -8099,6 +8732,9 @@ + + + @@ -8390,12 +9026,18 @@ + + + + + + @@ -8474,6 +9116,9 @@ + + + @@ -8507,6 +9152,9 @@ + + + @@ -8522,12 +9170,18 @@ + + + + + + @@ -8543,6 +9197,9 @@ + + + @@ -8558,18 +9215,27 @@ + + + + + + + + + @@ -8621,12 +9287,18 @@ + + + + + + @@ -8762,6 +9434,9 @@ + + + @@ -8831,6 +9506,9 @@ + + + @@ -8843,15 +9521,27 @@ + + + + + + + + + + + + @@ -8876,12 +9566,18 @@ + + + + + + @@ -8933,6 +9629,9 @@ + + + @@ -8957,24 +9656,36 @@ + + + + + + + + + + + + @@ -8999,6 +9710,9 @@ + + + @@ -9026,18 +9740,27 @@ + + + + + + + + + @@ -9053,12 +9776,18 @@ + + + + + + @@ -9083,6 +9812,9 @@ + + + @@ -9116,6 +9848,9 @@ + + + @@ -9131,12 +9866,18 @@ + + + + + + @@ -9191,14 +9932,17 @@ + + + - - + + @@ -9209,8 +9953,8 @@ - - + + @@ -9221,6 +9965,9 @@ + + + @@ -9236,12 +9983,18 @@ + + + + + + @@ -9302,6 +10055,9 @@ + + + @@ -9329,6 +10085,9 @@ + + + @@ -9356,6 +10115,9 @@ + + + @@ -9389,6 +10151,9 @@ + + + @@ -9404,30 +10169,45 @@ + + + + + + + + + + + + + + + @@ -9461,24 +10241,36 @@ + + + + + + + + + + + + @@ -9494,48 +10286,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + @@ -9551,18 +10367,27 @@ + + + + + + + + + @@ -9587,6 +10412,9 @@ + + + @@ -9614,12 +10442,18 @@ + + + + + + @@ -9653,12 +10487,18 @@ + + + + + + @@ -9683,12 +10523,18 @@ + + + + + + @@ -9854,6 +10700,9 @@ + + + @@ -9869,6 +10718,9 @@ + + + @@ -9902,6 +10754,9 @@ + + + @@ -9917,12 +10772,18 @@ + + + + + + @@ -9947,6 +10808,9 @@ + + + @@ -9971,6 +10835,9 @@ + + + @@ -9995,6 +10862,9 @@ + + + @@ -10064,6 +10934,9 @@ + + + @@ -10115,12 +10988,18 @@ + + + + + + @@ -10184,6 +11063,9 @@ + + + @@ -10298,12 +11180,18 @@ '}` or `>`?]]> + + '}` veya `>`?]]> + + + + @@ -10319,12 +11207,18 @@ + + + + + + @@ -10340,6 +11234,9 @@ + + + @@ -10364,18 +11261,27 @@ + + + + + + + + + @@ -10463,6 +11369,9 @@ + + + @@ -10478,6 +11387,9 @@ + + + @@ -10502,6 +11414,9 @@ + + + @@ -10544,12 +11459,18 @@ + + + + + + @@ -10610,6 +11531,9 @@ + + + @@ -10625,12 +11549,18 @@ + + + + + + @@ -10664,6 +11594,9 @@ + + + @@ -10679,24 +11612,36 @@ + + + + + + + + + + + + @@ -10712,6 +11657,9 @@ + + + @@ -10745,6 +11693,9 @@ + + + @@ -10769,18 +11720,27 @@ + + + + + + + + + @@ -10814,6 +11774,9 @@ + + + @@ -10937,6 +11900,9 @@ + + + @@ -10952,6 +11918,9 @@ + + + @@ -10976,6 +11945,9 @@ + + + @@ -10991,6 +11963,9 @@ + + + @@ -11015,18 +11990,27 @@ + + + + + + + + + @@ -11042,6 +12026,9 @@ + + + @@ -11057,18 +12044,27 @@ + + + + + + + + + @@ -11084,6 +12080,9 @@ + + + @@ -11102,6 +12101,9 @@ + + + @@ -11174,6 +12176,9 @@ + + + @@ -11192,6 +12197,9 @@ + + + @@ -11216,6 +12224,9 @@ + + + @@ -11303,12 +12314,18 @@ + + + + + + @@ -11378,12 +12395,18 @@ + + + + + + @@ -11399,18 +12422,27 @@ + + + + + + + + + @@ -11435,6 +12467,9 @@ + + + @@ -11507,6 +12542,9 @@ + + + @@ -11630,12 +12668,18 @@ + + + + + + diff --git a/src/server/editorServices.ts b/src/server/editorServices.ts index 3412c1c1598..47ab9e6a12f 100644 --- a/src/server/editorServices.ts +++ b/src/server/editorServices.ts @@ -2414,7 +2414,7 @@ namespace ts.server { this.openFilesWithNonRootedDiskPath.set(this.toCanonicalFileName(fileName), info); } } - if (openedByClient && !info.isScriptOpen()) { + if (openedByClient) { // Opening closed script info // either it was created just now, or was part of projects but was closed this.stopWatchingScriptInfo(info); @@ -2423,9 +2423,6 @@ namespace ts.server { info.registerFileUpdate(); } } - else { - Debug.assert(fileContent === undefined); - } return info; } @@ -3170,11 +3167,9 @@ namespace ts.server { const iterResult = openFiles.next(); if (iterResult.done) break; const file = iterResult.value; - const scriptInfo = this.getScriptInfo(file.fileName); - Debug.assert(!scriptInfo || !scriptInfo.isScriptOpen(), "Script should not exist and not be open already"); // Create script infos so we have the new content for all the open files before we do any updates to projects const info = this.getOrCreateOpenScriptInfo( - scriptInfo ? scriptInfo.fileName : toNormalizedPath(file.fileName), + toNormalizedPath(file.fileName), file.content, tryConvertScriptKindName(file.scriptKind!), file.hasMixedContent, diff --git a/src/testRunner/tsconfig.json b/src/testRunner/tsconfig.json index 909b2fe8c4d..5fdc05ae1ce 100644 --- a/src/testRunner/tsconfig.json +++ b/src/testRunner/tsconfig.json @@ -126,6 +126,7 @@ "unittests/tsbuild/transitiveReferences.ts", "unittests/tsbuild/watchEnvironment.ts", "unittests/tsbuild/watchMode.ts", + "unittests/tsc/composite.ts", "unittests/tsc/declarationEmit.ts", "unittests/tsc/incremental.ts", "unittests/tsc/listFilesOnly.ts", diff --git a/src/testRunner/unittests/config/commandLineParsing.ts b/src/testRunner/unittests/config/commandLineParsing.ts index 47e66bac197..8dbbffaf20d 100644 --- a/src/testRunner/unittests/config/commandLineParsing.ts +++ b/src/testRunner/unittests/config/commandLineParsing.ts @@ -1,11 +1,9 @@ namespace ts { describe("unittests:: config:: commandLineParsing:: parseCommandLine", () => { - function assertParseResult(commandLine: string[], expectedParsedCommandLine: ParsedCommandLine) { - const parsed = parseCommandLine(commandLine); - const parsedCompilerOptions = JSON.stringify(parsed.options); - const expectedCompilerOptions = JSON.stringify(expectedParsedCommandLine.options); - assert.equal(parsedCompilerOptions, expectedCompilerOptions); + function assertParseResult(commandLine: string[], expectedParsedCommandLine: ParsedCommandLine, workerDiagnostic?: () => ParseCommandLineWorkerDiagnostics) { + const parsed = parseCommandLineWorker(workerDiagnostic?.() || compilerOptionsDidYouMeanDiagnostics, commandLine); + assert.deepEqual(parsed.options, expectedParsedCommandLine.options); assert.deepEqual(parsed.watchOptions, expectedParsedCommandLine.watchOptions); const parsedErrors = parsed.errors; @@ -120,7 +118,7 @@ namespace ts { length: undefined, }], fileNames: ["0.ts"], - options: {} + options: { jsx: undefined } }); }); @@ -146,7 +144,7 @@ namespace ts { length: undefined, }], fileNames: ["0.ts"], - options: {} + options: { module: undefined } }); }); @@ -172,7 +170,7 @@ namespace ts { length: undefined, }], fileNames: ["0.ts"], - options: {} + options: { newLine: undefined } }); }); @@ -198,7 +196,7 @@ namespace ts { length: undefined, }], fileNames: ["0.ts"], - options: {} + options: { target: undefined } }); }); @@ -224,7 +222,7 @@ namespace ts { length: undefined, }], fileNames: ["0.ts"], - options: {} + options: { moduleResolution: undefined } }); }); @@ -414,6 +412,183 @@ namespace ts { }); }); + describe("parses command line null for tsconfig only option", () => { + interface VerifyNull { + optionName: string; + nonNullValue?: string; + workerDiagnostic?: () => ParseCommandLineWorkerDiagnostics; + diagnosticMessage: DiagnosticMessage; + } + function verifyNull({ optionName, nonNullValue, workerDiagnostic, diagnosticMessage }: VerifyNull) { + it("allows setting it to null", () => { + assertParseResult( + [`--${optionName}`, "null", "0.ts"], + { + errors: [], + fileNames: ["0.ts"], + options: { [optionName]: undefined } + }, + workerDiagnostic + ); + }); + + if (nonNullValue) { + it("errors if non null value is passed", () => { + assertParseResult( + [`--${optionName}`, nonNullValue, "0.ts"], + { + errors: [{ + messageText: formatStringFromArgs(diagnosticMessage.message, [optionName]), + category: diagnosticMessage.category, + code: diagnosticMessage.code, + file: undefined, + start: undefined, + length: undefined + }], + fileNames: ["0.ts"], + options: {} + }, + workerDiagnostic + ); + }); + } + + it("errors if its followed by another option", () => { + assertParseResult( + ["0.ts", "--strictNullChecks", `--${optionName}`], + { + errors: [{ + messageText: formatStringFromArgs(diagnosticMessage.message, [optionName]), + category: diagnosticMessage.category, + code: diagnosticMessage.code, + file: undefined, + start: undefined, + length: undefined + }], + fileNames: ["0.ts"], + options: { strictNullChecks: true } + }, + workerDiagnostic + ); + }); + + it("errors if its last option", () => { + assertParseResult( + ["0.ts", `--${optionName}`], + { + errors: [{ + messageText: formatStringFromArgs(diagnosticMessage.message, [optionName]), + category: diagnosticMessage.category, + code: diagnosticMessage.code, + file: undefined, + start: undefined, + length: undefined + }], + fileNames: ["0.ts"], + options: {} + }, + workerDiagnostic + ); + }); + } + + interface VerifyNullNonIncludedOption { + type: () => "string" | "number" | Map; + nonNullValue?: string; + } + function verifyNullNonIncludedOption({ type, nonNullValue }: VerifyNullNonIncludedOption) { + verifyNull({ + optionName: "optionName", + nonNullValue, + diagnosticMessage: Diagnostics.Option_0_can_only_be_specified_in_tsconfig_json_file_or_set_to_null_on_command_line, + workerDiagnostic: () => { + const optionDeclarations = [ + ...compilerOptionsDidYouMeanDiagnostics.optionDeclarations, + { + name: "optionName", + type: type(), + isTSConfigOnly: true, + category: Diagnostics.Basic_Options, + description: Diagnostics.Enable_project_compilation, + } + ]; + return { + ...compilerOptionsDidYouMeanDiagnostics, + optionDeclarations, + getOptionsNameMap: () => createOptionNameMap(optionDeclarations) + }; + } + }); + } + + describe("option of type boolean", () => { + it("allows setting it to false", () => { + assertParseResult( + ["--composite", "false", "0.ts"], + { + errors: [], + fileNames: ["0.ts"], + options: { composite: false } + } + ); + }); + + verifyNull({ + optionName: "composite", + nonNullValue: "true", + diagnosticMessage: Diagnostics.Option_0_can_only_be_specified_in_tsconfig_json_file_or_set_to_false_or_null_on_command_line + }); + }); + + describe("option of type object", () => { + verifyNull({ + optionName: "paths", + diagnosticMessage: Diagnostics.Option_0_can_only_be_specified_in_tsconfig_json_file_or_set_to_null_on_command_line + }); + }); + + describe("option of type list", () => { + verifyNull({ + optionName: "rootDirs", + nonNullValue: "abc,xyz", + diagnosticMessage: Diagnostics.Option_0_can_only_be_specified_in_tsconfig_json_file_or_set_to_null_on_command_line + }); + }); + + describe("option of type string", () => { + verifyNullNonIncludedOption({ + type: () => "string", + nonNullValue: "hello" + }); + }); + + describe("option of type number", () => { + verifyNullNonIncludedOption({ + type: () => "number", + nonNullValue: "10" + }); + }); + + describe("option of type Map", () => { + verifyNullNonIncludedOption({ + type: () => createMapFromTemplate({ + node: ModuleResolutionKind.NodeJs, + classic: ModuleResolutionKind.Classic, + }), + nonNullValue: "node" + }); + }); + }); + + it("allows tsconfig only option to be set to null", () => { + assertParseResult(["--composite", "null", "-tsBuildInfoFile", "null", "0.ts"], + { + errors: [], + fileNames: ["0.ts"], + options: { composite: undefined, tsBuildInfoFile: undefined } + }); + }); + describe("Watch options", () => { it("parse --watchFile", () => { assertParseResult(["--watchFile", "UseFsEvents", "0.ts"], @@ -487,9 +662,7 @@ namespace ts { describe("unittests:: config:: commandLineParsing:: parseBuildOptions", () => { function assertParseResult(commandLine: string[], expectedParsedBuildCommand: ParsedBuildCommand) { const parsed = parseBuildCommand(commandLine); - const parsedBuildOptions = JSON.stringify(parsed.buildOptions); - const expectedBuildOptions = JSON.stringify(expectedParsedBuildCommand.buildOptions); - assert.equal(parsedBuildOptions, expectedBuildOptions); + assert.deepEqual(parsed.buildOptions, expectedParsedBuildCommand.buildOptions); assert.deepEqual(parsed.watchOptions, expectedParsedBuildCommand.watchOptions); const parsedErrors = parsed.errors; diff --git a/src/testRunner/unittests/tsc/composite.ts b/src/testRunner/unittests/tsc/composite.ts new file mode 100644 index 00000000000..8eb0ea3bd85 --- /dev/null +++ b/src/testRunner/unittests/tsc/composite.ts @@ -0,0 +1,85 @@ +namespace ts { + describe("unittests:: tsc:: composite::", () => { + verifyTsc({ + scenario: "composite", + subScenario: "when setting composite false on command line", + fs: () => loadProjectFromFiles({ + "/src/project/src/main.ts": "export const x = 10;", + "/src/project/tsconfig.json": Utils.dedent` + { + "compilerOptions": { + "target": "es5", + "module": "commonjs", + "composite": true, + }, + "include": [ + "src/**/*.ts" + ] + }`, + }), + commandLineArgs: ["--composite", "false", "--p", "src/project"], + }); + + verifyTsc({ + scenario: "composite", + subScenario: "when setting composite null on command line", + fs: () => loadProjectFromFiles({ + "/src/project/src/main.ts": "export const x = 10;", + "/src/project/tsconfig.json": Utils.dedent` + { + "compilerOptions": { + "target": "es5", + "module": "commonjs", + "composite": true, + }, + "include": [ + "src/**/*.ts" + ] + }`, + }), + commandLineArgs: ["--composite", "null", "--p", "src/project"], + }); + + verifyTsc({ + scenario: "composite", + subScenario: "when setting composite false on command line but has tsbuild info in config", + fs: () => loadProjectFromFiles({ + "/src/project/src/main.ts": "export const x = 10;", + "/src/project/tsconfig.json": Utils.dedent` + { + "compilerOptions": { + "target": "es5", + "module": "commonjs", + "composite": true, + "tsBuildInfoFile": "tsconfig.json.tsbuildinfo" + }, + "include": [ + "src/**/*.ts" + ] + }`, + }), + commandLineArgs: ["--composite", "false", "--p", "src/project"], + }); + + verifyTsc({ + scenario: "composite", + subScenario: "when setting composite false and tsbuildinfo as null on command line but has tsbuild info in config", + fs: () => loadProjectFromFiles({ + "/src/project/src/main.ts": "export const x = 10;", + "/src/project/tsconfig.json": Utils.dedent` + { + "compilerOptions": { + "target": "es5", + "module": "commonjs", + "composite": true, + "tsBuildInfoFile": "tsconfig.json.tsbuildinfo" + }, + "include": [ + "src/**/*.ts" + ] + }`, + }), + commandLineArgs: ["--composite", "false", "--p", "src/project", "--tsBuildInfoFile", "null"], + }); + }); +} diff --git a/src/testRunner/unittests/tsserver/applyChangesToOpenFiles.ts b/src/testRunner/unittests/tsserver/applyChangesToOpenFiles.ts index 316ecc8b652..6d5ee91d68d 100644 --- a/src/testRunner/unittests/tsserver/applyChangesToOpenFiles.ts +++ b/src/testRunner/unittests/tsserver/applyChangesToOpenFiles.ts @@ -29,7 +29,11 @@ ${file.content}`; assert.equal(Number(project.getProjectVersion()), expected); } - function verify(applyChangesToOpen: (session: TestSession) => void) { + interface Verify { + applyChangesToOpen: (session: TestSession) => void; + openFile1Again: (session: TestSession) => void; + } + function verify({ applyChangesToOpen, openFile1Again }: Verify) { const host = createServerHost([app, file3, commonFile1, commonFile2, libFile, configFile]); const session = createSession(host); session.executeCommandSeq({ @@ -65,11 +69,22 @@ ${file.content}`; verifyText(service, commonFile2.path, fileContentWithComment(commonFile2)); verifyText(service, app.path, "let zzz = 10;let zz = 10;let z = 1;"); verifyText(service, file3.path, file3.content); + + // Open file1 again + openFile1Again(session); + assert.isTrue(service.getScriptInfo(commonFile1.path)!.isScriptOpen()); + + // Verify that file1 contents are changed + verifyProjectVersion(project, 4); + verifyText(service, commonFile1.path, commonFile1.content); + verifyText(service, commonFile2.path, fileContentWithComment(commonFile2)); + verifyText(service, app.path, "let zzz = 10;let zz = 10;let z = 1;"); + verifyText(service, file3.path, file3.content); } it("with applyChangedToOpenFiles request", () => { - verify(session => - session.executeCommandSeq({ + verify({ + applyChangesToOpen: session => session.executeCommandSeq({ command: protocol.CommandTypes.ApplyChangedToOpenFiles, arguments: { openFiles: [ @@ -101,13 +116,22 @@ ${file.content}`; file3.path ] } - }) - ); + }), + openFile1Again: session => session.executeCommandSeq({ + command: protocol.CommandTypes.ApplyChangedToOpenFiles, + arguments: { + openFiles: [{ + fileName: commonFile1.path, + content: commonFile1.content + }] + } + }), + }); }); it("with updateOpen request", () => { - verify(session => - session.executeCommandSeq({ + verify({ + applyChangesToOpen: session => session.executeCommandSeq({ command: protocol.CommandTypes.UpdateOpen, arguments: { openFiles: [ @@ -141,8 +165,17 @@ ${file.content}`; file3.path ] } - }) - ); + }), + openFile1Again: session => session.executeCommandSeq({ + command: protocol.CommandTypes.UpdateOpen, + arguments: { + openFiles: [{ + file: commonFile1.path, + fileContent: commonFile1.content + }] + } + }), + }); }); }); } diff --git a/src/testRunner/unittests/tsserver/openFile.ts b/src/testRunner/unittests/tsserver/openFile.ts index d2a995c68f8..62a7fcc729a 100644 --- a/src/testRunner/unittests/tsserver/openFile.ts +++ b/src/testRunner/unittests/tsserver/openFile.ts @@ -104,5 +104,29 @@ namespace ts.projectSystem { checkProjectActualFiles(project, files.map(f => f.path)); } }); + + it("can open same file again", () => { + const projectFolder = "/user/someuser/projects/myproject"; + const aFile: File = { + path: `${projectFolder}/src/a.ts`, + content: "export const x = 0;" + }; + const configFile: File = { + path: `${projectFolder}/tsconfig.json`, + content: "{}" + }; + const files = [aFile, configFile, libFile]; + const host = createServerHost(files); + const service = createProjectService(host); + verifyProject(aFile.content); + verifyProject(`${aFile.content}export const y = 10;`); + + function verifyProject(aFileContent: string) { + service.openClientFile(aFile.path, aFileContent, ScriptKind.TS, projectFolder); + const project = service.configuredProjects.get(configFile.path)!; + checkProjectActualFiles(project, files.map(f => f.path)); + assert.equal(project.getCurrentProgram()?.getSourceFile(aFile.path)!.text, aFileContent); + } + }); }); } diff --git a/tests/baselines/reference/aliasUsedAsNameValue.js b/tests/baselines/reference/aliasUsedAsNameValue.js index 168567eb80f..0f23419a930 100644 --- a/tests/baselines/reference/aliasUsedAsNameValue.js +++ b/tests/baselines/reference/aliasUsedAsNameValue.js @@ -21,6 +21,7 @@ export var a = function () { //// [aliasUsedAsNameValue_0.js] "use strict"; exports.__esModule = true; +exports.id = void 0; //// [aliasUsedAsNameValue_1.js] "use strict"; exports.__esModule = true; diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index 45f4d38414e..03a59f53345 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -1952,6 +1952,7 @@ declare namespace ts { getIdentifierCount(): number; getSymbolCount(): number; getTypeCount(): number; + getInstantiationCount(): number; getRelationCacheSizes(): { assignable: number; identity: number; diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index 83e2a6ac5d4..469e9e5b6aa 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -1952,6 +1952,7 @@ declare namespace ts { getIdentifierCount(): number; getSymbolCount(): number; getTypeCount(): number; + getInstantiationCount(): number; getRelationCacheSizes(): { assignable: number; identity: number; diff --git a/tests/baselines/reference/circularOptionalityRemoval.errors.txt b/tests/baselines/reference/circularOptionalityRemoval.errors.txt new file mode 100644 index 00000000000..2b60b5b6621 --- /dev/null +++ b/tests/baselines/reference/circularOptionalityRemoval.errors.txt @@ -0,0 +1,32 @@ +tests/cases/compiler/circularOptionalityRemoval.ts(2,14): error TS2502: 'x' is referenced directly or indirectly in its own type annotation. +tests/cases/compiler/circularOptionalityRemoval.ts(2,38): error TS2372: Parameter 'x' cannot be referenced in its initializer. +tests/cases/compiler/circularOptionalityRemoval.ts(2,38): error TS2532: Object is possibly 'undefined'. +tests/cases/compiler/circularOptionalityRemoval.ts(2,46): error TS2372: Parameter 'x' cannot be referenced in its initializer. +tests/cases/compiler/circularOptionalityRemoval.ts(5,14): error TS1015: Parameter cannot have question mark and initializer. +tests/cases/compiler/circularOptionalityRemoval.ts(5,14): error TS2502: 'x' is referenced directly or indirectly in its own type annotation. +tests/cases/compiler/circularOptionalityRemoval.ts(5,27): error TS2304: Cannot find name 'someCondition'. +tests/cases/compiler/circularOptionalityRemoval.ts(5,54): error TS2372: Parameter 'x' cannot be referenced in its initializer. + + +==== tests/cases/compiler/circularOptionalityRemoval.ts (8 errors) ==== + // Constructed repro + function fn1(x: number | undefined = x > 0 ? x : 0) { } + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2502: 'x' is referenced directly or indirectly in its own type annotation. + ~ +!!! error TS2372: Parameter 'x' cannot be referenced in its initializer. + ~ +!!! error TS2532: Object is possibly 'undefined'. + ~ +!!! error TS2372: Parameter 'x' cannot be referenced in its initializer. + + // Report from user + function fn2(x?: string = someCondition ? 'value1' : x) { } + ~ +!!! error TS1015: Parameter cannot have question mark and initializer. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2502: 'x' is referenced directly or indirectly in its own type annotation. + ~~~~~~~~~~~~~ +!!! error TS2304: Cannot find name 'someCondition'. + ~ +!!! error TS2372: Parameter 'x' cannot be referenced in its initializer. \ No newline at end of file diff --git a/tests/baselines/reference/circularOptionalityRemoval.js b/tests/baselines/reference/circularOptionalityRemoval.js new file mode 100644 index 00000000000..c584c2f3949 --- /dev/null +++ b/tests/baselines/reference/circularOptionalityRemoval.js @@ -0,0 +1,16 @@ +//// [circularOptionalityRemoval.ts] +// Constructed repro +function fn1(x: number | undefined = x > 0 ? x : 0) { } + +// Report from user +function fn2(x?: string = someCondition ? 'value1' : x) { } + +//// [circularOptionalityRemoval.js] +// Constructed repro +function fn1(x) { + if (x === void 0) { x = x > 0 ? x : 0; } +} +// Report from user +function fn2(x) { + if (x === void 0) { x = someCondition ? 'value1' : x; } +} diff --git a/tests/baselines/reference/circularOptionalityRemoval.symbols b/tests/baselines/reference/circularOptionalityRemoval.symbols new file mode 100644 index 00000000000..06bfd9da771 --- /dev/null +++ b/tests/baselines/reference/circularOptionalityRemoval.symbols @@ -0,0 +1,14 @@ +=== tests/cases/compiler/circularOptionalityRemoval.ts === +// Constructed repro +function fn1(x: number | undefined = x > 0 ? x : 0) { } +>fn1 : Symbol(fn1, Decl(circularOptionalityRemoval.ts, 0, 0)) +>x : Symbol(x, Decl(circularOptionalityRemoval.ts, 1, 13)) +>x : Symbol(x, Decl(circularOptionalityRemoval.ts, 1, 13)) +>x : Symbol(x, Decl(circularOptionalityRemoval.ts, 1, 13)) + +// Report from user +function fn2(x?: string = someCondition ? 'value1' : x) { } +>fn2 : Symbol(fn2, Decl(circularOptionalityRemoval.ts, 1, 55)) +>x : Symbol(x, Decl(circularOptionalityRemoval.ts, 4, 13)) +>x : Symbol(x, Decl(circularOptionalityRemoval.ts, 4, 13)) + diff --git a/tests/baselines/reference/circularOptionalityRemoval.types b/tests/baselines/reference/circularOptionalityRemoval.types new file mode 100644 index 00000000000..5783b24a6c3 --- /dev/null +++ b/tests/baselines/reference/circularOptionalityRemoval.types @@ -0,0 +1,21 @@ +=== tests/cases/compiler/circularOptionalityRemoval.ts === +// Constructed repro +function fn1(x: number | undefined = x > 0 ? x : 0) { } +>fn1 : (x?: number | undefined) => void +>x : number | undefined +>x > 0 ? x : 0 : number | undefined +>x > 0 : boolean +>x : number | undefined +>0 : 0 +>x : number | undefined +>0 : 0 + +// Report from user +function fn2(x?: string = someCondition ? 'value1' : x) { } +>fn2 : (x?: string | undefined) => void +>x : string | undefined +>someCondition ? 'value1' : x : string | undefined +>someCondition : any +>'value1' : "value1" +>x : string | undefined + diff --git a/tests/baselines/reference/classMemberInitializerWithLamdaScoping4.js b/tests/baselines/reference/classMemberInitializerWithLamdaScoping4.js index a0aa11d30d6..721e1b42eb8 100644 --- a/tests/baselines/reference/classMemberInitializerWithLamdaScoping4.js +++ b/tests/baselines/reference/classMemberInitializerWithLamdaScoping4.js @@ -18,6 +18,7 @@ export class Test1 { //// [classMemberInitializerWithLamdaScoping3_0.js] "use strict"; exports.__esModule = true; +exports.field1 = void 0; //// [classMemberInitializerWithLamdaScoping3_1.js] "use strict"; exports.__esModule = true; diff --git a/tests/baselines/reference/commentsBeforeVariableStatement1.js b/tests/baselines/reference/commentsBeforeVariableStatement1.js index 9a06a3e7c22..f0d6b3ad3ae 100644 --- a/tests/baselines/reference/commentsBeforeVariableStatement1.js +++ b/tests/baselines/reference/commentsBeforeVariableStatement1.js @@ -7,4 +7,6 @@ export var b: number; define(["require", "exports"], function (require, exports) { "use strict"; exports.__esModule = true; + /** b's comment*/ + exports.b = void 0; }); diff --git a/tests/baselines/reference/declFileAmbientExternalModuleWithSingleExportedModule.js b/tests/baselines/reference/declFileAmbientExternalModuleWithSingleExportedModule.js index 627a1865d8f..d31237753aa 100644 --- a/tests/baselines/reference/declFileAmbientExternalModuleWithSingleExportedModule.js +++ b/tests/baselines/reference/declFileAmbientExternalModuleWithSingleExportedModule.js @@ -21,6 +21,7 @@ export var x: SubModule.m.m3.c; //// [declFileAmbientExternalModuleWithSingleExportedModule_1.js] "use strict"; exports.__esModule = true; +exports.x = void 0; //// [declFileAmbientExternalModuleWithSingleExportedModule_0.d.ts] diff --git a/tests/baselines/reference/declFileExportAssignmentOfGenericInterface.js b/tests/baselines/reference/declFileExportAssignmentOfGenericInterface.js index cefff0be4ea..d1a56d4a5f9 100644 --- a/tests/baselines/reference/declFileExportAssignmentOfGenericInterface.js +++ b/tests/baselines/reference/declFileExportAssignmentOfGenericInterface.js @@ -20,6 +20,7 @@ define(["require", "exports"], function (require, exports) { define(["require", "exports"], function (require, exports) { "use strict"; exports.__esModule = true; + exports.x = void 0; exports.x.a; }); diff --git a/tests/baselines/reference/declFileExportImportChain.js b/tests/baselines/reference/declFileExportImportChain.js index 8a6b297f81d..238d40c23a4 100644 --- a/tests/baselines/reference/declFileExportImportChain.js +++ b/tests/baselines/reference/declFileExportImportChain.js @@ -61,6 +61,7 @@ define(["require", "exports", "declFileExportImportChain_b1"], function (require define(["require", "exports"], function (require, exports) { "use strict"; exports.__esModule = true; + exports.x = void 0; }); diff --git a/tests/baselines/reference/declFileExportImportChain2.js b/tests/baselines/reference/declFileExportImportChain2.js index 684ac2a1dfb..c2c9ffe6789 100644 --- a/tests/baselines/reference/declFileExportImportChain2.js +++ b/tests/baselines/reference/declFileExportImportChain2.js @@ -52,6 +52,7 @@ define(["require", "exports", "declFileExportImportChain2_b"], function (require define(["require", "exports"], function (require, exports) { "use strict"; exports.__esModule = true; + exports.x = void 0; }); diff --git a/tests/baselines/reference/declFileForExportedImport.js b/tests/baselines/reference/declFileForExportedImport.js index 809f01878d4..42dfc2fa8fe 100644 --- a/tests/baselines/reference/declFileForExportedImport.js +++ b/tests/baselines/reference/declFileForExportedImport.js @@ -14,6 +14,7 @@ var z = b.x; //// [declFileForExportedImport_0.js] "use strict"; exports.__esModule = true; +exports.x = void 0; //// [declFileForExportedImport_1.js] "use strict"; exports.__esModule = true; diff --git a/tests/baselines/reference/declFileGenericType.js b/tests/baselines/reference/declFileGenericType.js index c95fc26d318..2f7be9484b7 100644 --- a/tests/baselines/reference/declFileGenericType.js +++ b/tests/baselines/reference/declFileGenericType.js @@ -89,6 +89,7 @@ var C; }()); C.D = D; })(C = exports.C || (exports.C = {})); +exports.a = void 0; exports.b = C.F; exports.c = C.F2; exports.d = C.F3; diff --git a/tests/baselines/reference/decoratorOnImportEquals2.js b/tests/baselines/reference/decoratorOnImportEquals2.js index aa8273699e3..78b352959c2 100644 --- a/tests/baselines/reference/decoratorOnImportEquals2.js +++ b/tests/baselines/reference/decoratorOnImportEquals2.js @@ -12,6 +12,7 @@ declare function dec(target: T): T; //// [decoratorOnImportEquals2_0.js] "use strict"; exports.__esModule = true; +exports.X = void 0; //// [decoratorOnImportEquals2_1.js] "use strict"; exports.__esModule = true; diff --git a/tests/baselines/reference/destructuringAssignmentWithExportedName.js b/tests/baselines/reference/destructuringAssignmentWithExportedName.js index 4dc60ecff77..9ebc9073a77 100644 --- a/tests/baselines/reference/destructuringAssignmentWithExportedName.js +++ b/tests/baselines/reference/destructuringAssignmentWithExportedName.js @@ -29,6 +29,7 @@ export { exportedFoo as foo, nonexportedFoo as nfoo }; "use strict"; var _a, _b, _c, _d, _e; Object.defineProperty(exports, "__esModule", { value: true }); +exports.exportedFoo = void 0; exports.foo = exports.exportedFoo; let nonexportedFoo; exports.nonexportedFoo = nonexportedFoo; diff --git a/tests/baselines/reference/errorForConflictingExportEqualsValue.js b/tests/baselines/reference/errorForConflictingExportEqualsValue.js index 65adec35902..9d5514422c8 100644 --- a/tests/baselines/reference/errorForConflictingExportEqualsValue.js +++ b/tests/baselines/reference/errorForConflictingExportEqualsValue.js @@ -6,5 +6,6 @@ import("./a"); //// [a.js] "use strict"; +exports.x = void 0; Promise.resolve().then(function () { return require("./a"); }); module.exports = exports.x; diff --git a/tests/baselines/reference/excessPropertyChecksWithNestedIntersections.js b/tests/baselines/reference/excessPropertyChecksWithNestedIntersections.js index e242825b852..5f4f49217a8 100644 --- a/tests/baselines/reference/excessPropertyChecksWithNestedIntersections.js +++ b/tests/baselines/reference/excessPropertyChecksWithNestedIntersections.js @@ -81,6 +81,7 @@ var c = { a: { x: 'hello', y: 2 } }; // error - y does not exist in type A var d = { a: { x: 'hello' }, c: 5 }; // ok var e = { a: { x: 2 }, c: 5 }; // error - types of property x are incompatible var f = { a: { x: 'hello', y: 2 }, c: 5 }; // error - y does not exist in type A +exports.obj = void 0; exports.photo = { id: 1, url: '', diff --git a/tests/baselines/reference/exportNonInitializedVariablesAMD.js b/tests/baselines/reference/exportNonInitializedVariablesAMD.js index 24ecd232495..c22b8d5a458 100644 --- a/tests/baselines/reference/exportNonInitializedVariablesAMD.js +++ b/tests/baselines/reference/exportNonInitializedVariablesAMD.js @@ -40,11 +40,17 @@ define(["require", "exports"], function (require, exports) { var ; let; var ; + exports.a = void 0; + exports.b = void 0; + exports.c = void 0; + exports.d = void 0; var A = /** @class */ (function () { function A() { } return A; }()); + exports.e = void 0; + exports.f = void 0; var B; (function (B) { B.a = 1, B.c = 2; diff --git a/tests/baselines/reference/exportNonInitializedVariablesCommonJS.js b/tests/baselines/reference/exportNonInitializedVariablesCommonJS.js index 8b4475e4bf9..bfa215c0629 100644 --- a/tests/baselines/reference/exportNonInitializedVariablesCommonJS.js +++ b/tests/baselines/reference/exportNonInitializedVariablesCommonJS.js @@ -39,11 +39,17 @@ exports.__esModule = true; var ; let; var ; +exports.a = void 0; +exports.b = void 0; +exports.c = void 0; +exports.d = void 0; var A = /** @class */ (function () { function A() { } return A; }()); +exports.e = void 0; +exports.f = void 0; var B; (function (B) { B.a = 1, B.c = 2; diff --git a/tests/baselines/reference/exportNonInitializedVariablesUMD.js b/tests/baselines/reference/exportNonInitializedVariablesUMD.js index bbea71b763d..f2665d67b10 100644 --- a/tests/baselines/reference/exportNonInitializedVariablesUMD.js +++ b/tests/baselines/reference/exportNonInitializedVariablesUMD.js @@ -48,11 +48,17 @@ export let h1: D = new D; var ; let; var ; + exports.a = void 0; + exports.b = void 0; + exports.c = void 0; + exports.d = void 0; var A = /** @class */ (function () { function A() { } return A; }()); + exports.e = void 0; + exports.f = void 0; var B; (function (B) { B.a = 1, B.c = 2; diff --git a/tests/baselines/reference/exportStarForValues5.js b/tests/baselines/reference/exportStarForValues5.js index 812058ebd06..53e7c68907a 100644 --- a/tests/baselines/reference/exportStarForValues5.js +++ b/tests/baselines/reference/exportStarForValues5.js @@ -16,4 +16,5 @@ define(["require", "exports"], function (require, exports) { define(["require", "exports"], function (require, exports) { "use strict"; exports.__esModule = true; + exports.x = void 0; }); diff --git a/tests/baselines/reference/giant.js b/tests/baselines/reference/giant.js index 9adf046d8cf..cff0440a5f5 100644 --- a/tests/baselines/reference/giant.js +++ b/tests/baselines/reference/giant.js @@ -901,6 +901,7 @@ define(["require", "exports"], function (require, exports) { })(eM = M_1.eM || (M_1.eM = {})); ; })(M || (M = {})); + exports.eV = void 0; function eF() { } exports.eF = eF; ; diff --git a/tests/baselines/reference/importDecl.js b/tests/baselines/reference/importDecl.js index 2eb9208910a..3fa11f81aba 100644 --- a/tests/baselines/reference/importDecl.js +++ b/tests/baselines/reference/importDecl.js @@ -90,6 +90,7 @@ var d = /** @class */ (function () { return d; }()); exports.d = d; +exports.x = void 0; function foo() { return null; } exports.foo = foo; //// [importDecl_require1.js] @@ -113,6 +114,7 @@ var d = /** @class */ (function () { return d; }()); exports.d = d; +exports.x = void 0; function foo() { return null; } exports.foo = foo; //// [importDecl_require3.js] @@ -124,6 +126,7 @@ var d = /** @class */ (function () { return d; }()); exports.d = d; +exports.x = void 0; function foo() { return null; } exports.foo = foo; //// [importDecl_require4.js] diff --git a/tests/baselines/reference/importDeclarationUsedAsTypeQuery.js b/tests/baselines/reference/importDeclarationUsedAsTypeQuery.js index a6431f6a2c3..bbcca5d2024 100644 --- a/tests/baselines/reference/importDeclarationUsedAsTypeQuery.js +++ b/tests/baselines/reference/importDeclarationUsedAsTypeQuery.js @@ -23,6 +23,7 @@ exports.B = B; //// [importDeclarationUsedAsTypeQuery_1.js] "use strict"; exports.__esModule = true; +exports.x = void 0; //// [importDeclarationUsedAsTypeQuery_require.d.ts] diff --git a/tests/baselines/reference/internalAliasInterfaceInsideTopLevelModuleWithExport.js b/tests/baselines/reference/internalAliasInterfaceInsideTopLevelModuleWithExport.js index 4434670366c..5202f89d4d9 100644 --- a/tests/baselines/reference/internalAliasInterfaceInsideTopLevelModuleWithExport.js +++ b/tests/baselines/reference/internalAliasInterfaceInsideTopLevelModuleWithExport.js @@ -11,6 +11,7 @@ export var x: b; //// [internalAliasInterfaceInsideTopLevelModuleWithExport.js] "use strict"; exports.__esModule = true; +exports.x = void 0; //// [internalAliasInterfaceInsideTopLevelModuleWithExport.d.ts] diff --git a/tests/baselines/reference/internalAliasInterfaceInsideTopLevelModuleWithoutExport.js b/tests/baselines/reference/internalAliasInterfaceInsideTopLevelModuleWithoutExport.js index 5645c76ed2a..e6bdc2d2737 100644 --- a/tests/baselines/reference/internalAliasInterfaceInsideTopLevelModuleWithoutExport.js +++ b/tests/baselines/reference/internalAliasInterfaceInsideTopLevelModuleWithoutExport.js @@ -12,6 +12,7 @@ export var x: b; define(["require", "exports"], function (require, exports) { "use strict"; exports.__esModule = true; + exports.x = void 0; }); diff --git a/tests/baselines/reference/internalAliasUninitializedModuleInsideLocalModuleWithoutExportAccessError.js b/tests/baselines/reference/internalAliasUninitializedModuleInsideLocalModuleWithoutExportAccessError.js index a6b4f83de8e..37b2fca2de8 100644 --- a/tests/baselines/reference/internalAliasUninitializedModuleInsideLocalModuleWithoutExportAccessError.js +++ b/tests/baselines/reference/internalAliasUninitializedModuleInsideLocalModuleWithoutExportAccessError.js @@ -24,4 +24,5 @@ define(["require", "exports"], function (require, exports) { (function (c) { c.x.foo(); })(c = exports.c || (exports.c = {})); + exports.z = void 0; }); diff --git a/tests/baselines/reference/internalAliasUninitializedModuleInsideTopLevelModuleWithExport.js b/tests/baselines/reference/internalAliasUninitializedModuleInsideTopLevelModuleWithExport.js index eccbd9a45bd..523f4f07ff3 100644 --- a/tests/baselines/reference/internalAliasUninitializedModuleInsideTopLevelModuleWithExport.js +++ b/tests/baselines/reference/internalAliasUninitializedModuleInsideTopLevelModuleWithExport.js @@ -16,6 +16,7 @@ x.foo(); define(["require", "exports"], function (require, exports) { "use strict"; exports.__esModule = true; + exports.x = void 0; exports.x.foo(); }); diff --git a/tests/baselines/reference/internalAliasUninitializedModuleInsideTopLevelModuleWithoutExport.js b/tests/baselines/reference/internalAliasUninitializedModuleInsideTopLevelModuleWithoutExport.js index 27de6bbfd98..3004c9c0e9b 100644 --- a/tests/baselines/reference/internalAliasUninitializedModuleInsideTopLevelModuleWithoutExport.js +++ b/tests/baselines/reference/internalAliasUninitializedModuleInsideTopLevelModuleWithoutExport.js @@ -15,6 +15,7 @@ x.foo(); //// [internalAliasUninitializedModuleInsideTopLevelModuleWithoutExport.js] "use strict"; exports.__esModule = true; +exports.x = void 0; exports.x.foo(); diff --git a/tests/baselines/reference/isolatedModulesSpecifiedModule.js b/tests/baselines/reference/isolatedModulesSpecifiedModule.js index 895c47e2504..540dd535b77 100644 --- a/tests/baselines/reference/isolatedModulesSpecifiedModule.js +++ b/tests/baselines/reference/isolatedModulesSpecifiedModule.js @@ -4,3 +4,4 @@ export var x; //// [file1.js] "use strict"; exports.__esModule = true; +exports.x = void 0; diff --git a/tests/baselines/reference/isolatedModulesUnspecifiedModule.js b/tests/baselines/reference/isolatedModulesUnspecifiedModule.js index 895c47e2504..540dd535b77 100644 --- a/tests/baselines/reference/isolatedModulesUnspecifiedModule.js +++ b/tests/baselines/reference/isolatedModulesUnspecifiedModule.js @@ -4,3 +4,4 @@ export var x; //// [file1.js] "use strict"; exports.__esModule = true; +exports.x = void 0; diff --git a/tests/baselines/reference/moduleAliasAsFunctionArgument.js b/tests/baselines/reference/moduleAliasAsFunctionArgument.js index 16eb962a863..0630c1011cb 100644 --- a/tests/baselines/reference/moduleAliasAsFunctionArgument.js +++ b/tests/baselines/reference/moduleAliasAsFunctionArgument.js @@ -18,6 +18,7 @@ fn(a); // Error: property 'x' is missing from 'a' define(["require", "exports"], function (require, exports) { "use strict"; exports.__esModule = true; + exports.x = void 0; }); //// [moduleAliasAsFunctionArgument_1.js] define(["require", "exports", "moduleAliasAsFunctionArgument_0"], function (require, exports, a) { diff --git a/tests/baselines/reference/nodeResolution4.js b/tests/baselines/reference/nodeResolution4.js index 3285f3b8e20..1613cdfb213 100644 --- a/tests/baselines/reference/nodeResolution4.js +++ b/tests/baselines/reference/nodeResolution4.js @@ -15,6 +15,8 @@ var x = 1; //// [a.js] "use strict"; exports.__esModule = true; +/// +exports.y = void 0; //// [b.js] "use strict"; exports.__esModule = true; diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution7_classic.js b/tests/baselines/reference/pathMappingBasedModuleResolution7_classic.js index 55aca054e82..aa9d4d7db9e 100644 --- a/tests/baselines/reference/pathMappingBasedModuleResolution7_classic.js +++ b/tests/baselines/reference/pathMappingBasedModuleResolution7_classic.js @@ -32,6 +32,7 @@ export let y: number; define(["require", "exports"], function (require, exports) { "use strict"; exports.__esModule = true; + exports.b = void 0; }); //// [file2.js] define(["require", "exports", "module1", "templates/module2", "../file3"], function (require, exports, module1_1, module2_1, file3_1) { diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution7_node.js b/tests/baselines/reference/pathMappingBasedModuleResolution7_node.js index 303b98f4d83..94c1c182007 100644 --- a/tests/baselines/reference/pathMappingBasedModuleResolution7_node.js +++ b/tests/baselines/reference/pathMappingBasedModuleResolution7_node.js @@ -31,6 +31,7 @@ export let y: number; //// [module2.js] "use strict"; exports.__esModule = true; +exports.b = void 0; //// [file2.js] "use strict"; exports.__esModule = true; diff --git a/tests/baselines/reference/privacyCheckTypeOfFunction.js b/tests/baselines/reference/privacyCheckTypeOfFunction.js index ca9878c6727..ce86f7bca35 100644 --- a/tests/baselines/reference/privacyCheckTypeOfFunction.js +++ b/tests/baselines/reference/privacyCheckTypeOfFunction.js @@ -10,6 +10,7 @@ export var b = foo; exports.__esModule = true; function foo() { } +exports.x = void 0; exports.b = foo; diff --git a/tests/baselines/reference/privacyTopLevelInternalReferenceImportWithExport.js b/tests/baselines/reference/privacyTopLevelInternalReferenceImportWithExport.js index b2da49d083e..60dcb9dfaa5 100644 --- a/tests/baselines/reference/privacyTopLevelInternalReferenceImportWithExport.js +++ b/tests/baselines/reference/privacyTopLevelInternalReferenceImportWithExport.js @@ -177,9 +177,11 @@ define(["require", "exports"], function (require, exports) { var privateUse_im_public_v_private = exports.im_public_v_private; exports.publicUse_im_public_v_private = exports.im_public_v_private; var privateUse_im_public_i_private; + exports.publicUse_im_public_i_private = void 0; var privateUse_im_public_mi_private = new exports.im_public_mi_private.c(); exports.publicUse_im_public_mi_private = new exports.im_public_mi_private.c(); var privateUse_im_public_mu_private; + exports.publicUse_im_public_mu_private = void 0; // No Privacy errors - importing public elements exports.im_public_c_public = m_public.c_public; exports.im_public_e_public = m_public.e_public; @@ -196,9 +198,11 @@ define(["require", "exports"], function (require, exports) { var privateUse_im_public_v_public = exports.im_public_v_public; exports.publicUse_im_public_v_public = exports.im_public_v_public; var privateUse_im_public_i_public; + exports.publicUse_im_public_i_public = void 0; var privateUse_im_public_mi_public = new exports.im_public_mi_public.c(); exports.publicUse_im_public_mi_public = new exports.im_public_mi_public.c(); var privateUse_im_public_mu_public; + exports.publicUse_im_public_mu_public = void 0; }); diff --git a/tests/baselines/reference/privacyTopLevelInternalReferenceImportWithoutExport.js b/tests/baselines/reference/privacyTopLevelInternalReferenceImportWithoutExport.js index eefb1a7627f..e2cd1e4bb79 100644 --- a/tests/baselines/reference/privacyTopLevelInternalReferenceImportWithoutExport.js +++ b/tests/baselines/reference/privacyTopLevelInternalReferenceImportWithoutExport.js @@ -177,9 +177,11 @@ define(["require", "exports"], function (require, exports) { var privateUse_im_private_v_private = im_private_v_private; exports.publicUse_im_private_v_private = im_private_v_private; var privateUse_im_private_i_private; + exports.publicUse_im_private_i_private = void 0; var privateUse_im_private_mi_private = new im_private_mi_private.c(); exports.publicUse_im_private_mi_private = new im_private_mi_private.c(); var privateUse_im_private_mu_private; + exports.publicUse_im_private_mu_private = void 0; // No Privacy errors - importing public elements var im_private_c_public = m_public.c_public; var im_private_e_public = m_public.e_public; @@ -196,9 +198,11 @@ define(["require", "exports"], function (require, exports) { var privateUse_im_private_v_public = im_private_v_public; exports.publicUse_im_private_v_public = im_private_v_public; var privateUse_im_private_i_public; + exports.publicUse_im_private_i_public = void 0; var privateUse_im_private_mi_public = new im_private_mi_public.c(); exports.publicUse_im_private_mi_public = new im_private_mi_public.c(); var privateUse_im_private_mu_public; + exports.publicUse_im_private_mu_public = void 0; }); diff --git a/tests/baselines/reference/privacyVar.js b/tests/baselines/reference/privacyVar.js index ccaf7e1f1b7..9a08894cefc 100644 --- a/tests/baselines/reference/privacyVar.js +++ b/tests/baselines/reference/privacyVar.js @@ -324,7 +324,9 @@ var glo_C4_public = /** @class */ (function () { return glo_C4_public; }()); var glo_v1_private; +exports.glo_v2_public = void 0; var glo_v3_private; +exports.glo_v4_public = void 0; // error var glo_v11_private = new glo_C1_public(); exports.glo_v12_public = new glo_C1_public(); var glo_v13_private = new glo_C2_private(); diff --git a/tests/baselines/reference/privacyVarDeclFile.js b/tests/baselines/reference/privacyVarDeclFile.js index 76d69b2a2ef..6899d04f2a7 100644 --- a/tests/baselines/reference/privacyVarDeclFile.js +++ b/tests/baselines/reference/privacyVarDeclFile.js @@ -460,6 +460,8 @@ var privateClassWithWithPublicPropertyTypes = /** @class */ (function () { } return privateClassWithWithPublicPropertyTypes; }()); +exports.publicVarWithPrivatePropertyTypes = void 0; // Error +exports.publicVarWithPublicPropertyTypes = void 0; var privateVarWithPrivatePropertyTypes; var privateVarWithPublicPropertyTypes; var publicClassWithPrivateModulePropertyTypes = /** @class */ (function () { @@ -468,6 +470,7 @@ var publicClassWithPrivateModulePropertyTypes = /** @class */ (function () { return publicClassWithPrivateModulePropertyTypes; }()); exports.publicClassWithPrivateModulePropertyTypes = publicClassWithPrivateModulePropertyTypes; +exports.publicVarWithPrivateModulePropertyTypes = void 0; // Error var privateClassWithPrivateModulePropertyTypes = /** @class */ (function () { function privateClassWithPrivateModulePropertyTypes() { } diff --git a/tests/baselines/reference/project/declarationsCascadingImports/amd/m4.js b/tests/baselines/reference/project/declarationsCascadingImports/amd/m4.js index 24e2e443bfe..eaaad1d5f7c 100644 --- a/tests/baselines/reference/project/declarationsCascadingImports/amd/m4.js +++ b/tests/baselines/reference/project/declarationsCascadingImports/amd/m4.js @@ -8,6 +8,7 @@ define(["require", "exports"], function (require, exports) { }()); exports.d = d; ; + exports.x = void 0; function foo() { return new d(); } diff --git a/tests/baselines/reference/project/declarationsCascadingImports/node/m4.js b/tests/baselines/reference/project/declarationsCascadingImports/node/m4.js index 7a8d072b08d..fb8354c309b 100644 --- a/tests/baselines/reference/project/declarationsCascadingImports/node/m4.js +++ b/tests/baselines/reference/project/declarationsCascadingImports/node/m4.js @@ -7,6 +7,7 @@ var d = /** @class */ (function () { }()); exports.d = d; ; +exports.x = void 0; function foo() { return new d(); } diff --git a/tests/baselines/reference/project/declarationsGlobalImport/amd/glo_m4.js b/tests/baselines/reference/project/declarationsGlobalImport/amd/glo_m4.js index 24e2e443bfe..eaaad1d5f7c 100644 --- a/tests/baselines/reference/project/declarationsGlobalImport/amd/glo_m4.js +++ b/tests/baselines/reference/project/declarationsGlobalImport/amd/glo_m4.js @@ -8,6 +8,7 @@ define(["require", "exports"], function (require, exports) { }()); exports.d = d; ; + exports.x = void 0; function foo() { return new d(); } diff --git a/tests/baselines/reference/project/declarationsGlobalImport/node/glo_m4.js b/tests/baselines/reference/project/declarationsGlobalImport/node/glo_m4.js index 7a8d072b08d..fb8354c309b 100644 --- a/tests/baselines/reference/project/declarationsGlobalImport/node/glo_m4.js +++ b/tests/baselines/reference/project/declarationsGlobalImport/node/glo_m4.js @@ -7,6 +7,7 @@ var d = /** @class */ (function () { }()); exports.d = d; ; +exports.x = void 0; function foo() { return new d(); } diff --git a/tests/baselines/reference/project/declarationsImportedInPrivate/amd/private_m4.js b/tests/baselines/reference/project/declarationsImportedInPrivate/amd/private_m4.js index 24e2e443bfe..eaaad1d5f7c 100644 --- a/tests/baselines/reference/project/declarationsImportedInPrivate/amd/private_m4.js +++ b/tests/baselines/reference/project/declarationsImportedInPrivate/amd/private_m4.js @@ -8,6 +8,7 @@ define(["require", "exports"], function (require, exports) { }()); exports.d = d; ; + exports.x = void 0; function foo() { return new d(); } diff --git a/tests/baselines/reference/project/declarationsImportedInPrivate/node/private_m4.js b/tests/baselines/reference/project/declarationsImportedInPrivate/node/private_m4.js index 7a8d072b08d..fb8354c309b 100644 --- a/tests/baselines/reference/project/declarationsImportedInPrivate/node/private_m4.js +++ b/tests/baselines/reference/project/declarationsImportedInPrivate/node/private_m4.js @@ -7,6 +7,7 @@ var d = /** @class */ (function () { }()); exports.d = d; ; +exports.x = void 0; function foo() { return new d(); } diff --git a/tests/baselines/reference/project/declarationsImportedUseInFunction/amd/fncOnly_m4.js b/tests/baselines/reference/project/declarationsImportedUseInFunction/amd/fncOnly_m4.js index 24e2e443bfe..eaaad1d5f7c 100644 --- a/tests/baselines/reference/project/declarationsImportedUseInFunction/amd/fncOnly_m4.js +++ b/tests/baselines/reference/project/declarationsImportedUseInFunction/amd/fncOnly_m4.js @@ -8,6 +8,7 @@ define(["require", "exports"], function (require, exports) { }()); exports.d = d; ; + exports.x = void 0; function foo() { return new d(); } diff --git a/tests/baselines/reference/project/declarationsImportedUseInFunction/node/fncOnly_m4.js b/tests/baselines/reference/project/declarationsImportedUseInFunction/node/fncOnly_m4.js index 7a8d072b08d..fb8354c309b 100644 --- a/tests/baselines/reference/project/declarationsImportedUseInFunction/node/fncOnly_m4.js +++ b/tests/baselines/reference/project/declarationsImportedUseInFunction/node/fncOnly_m4.js @@ -7,6 +7,7 @@ var d = /** @class */ (function () { }()); exports.d = d; ; +exports.x = void 0; function foo() { return new d(); } diff --git a/tests/baselines/reference/project/declarationsIndirectImportShouldResultInError/amd/m4.js b/tests/baselines/reference/project/declarationsIndirectImportShouldResultInError/amd/m4.js index 24e2e443bfe..eaaad1d5f7c 100644 --- a/tests/baselines/reference/project/declarationsIndirectImportShouldResultInError/amd/m4.js +++ b/tests/baselines/reference/project/declarationsIndirectImportShouldResultInError/amd/m4.js @@ -8,6 +8,7 @@ define(["require", "exports"], function (require, exports) { }()); exports.d = d; ; + exports.x = void 0; function foo() { return new d(); } diff --git a/tests/baselines/reference/project/declarationsIndirectImportShouldResultInError/node/m4.js b/tests/baselines/reference/project/declarationsIndirectImportShouldResultInError/node/m4.js index 7a8d072b08d..fb8354c309b 100644 --- a/tests/baselines/reference/project/declarationsIndirectImportShouldResultInError/node/m4.js +++ b/tests/baselines/reference/project/declarationsIndirectImportShouldResultInError/node/m4.js @@ -7,6 +7,7 @@ var d = /** @class */ (function () { }()); exports.d = d; ; +exports.x = void 0; function foo() { return new d(); } diff --git a/tests/baselines/reference/project/declarationsMultipleTimesImport/amd/m4.js b/tests/baselines/reference/project/declarationsMultipleTimesImport/amd/m4.js index 24e2e443bfe..eaaad1d5f7c 100644 --- a/tests/baselines/reference/project/declarationsMultipleTimesImport/amd/m4.js +++ b/tests/baselines/reference/project/declarationsMultipleTimesImport/amd/m4.js @@ -8,6 +8,7 @@ define(["require", "exports"], function (require, exports) { }()); exports.d = d; ; + exports.x = void 0; function foo() { return new d(); } diff --git a/tests/baselines/reference/project/declarationsMultipleTimesImport/node/m4.js b/tests/baselines/reference/project/declarationsMultipleTimesImport/node/m4.js index 7a8d072b08d..fb8354c309b 100644 --- a/tests/baselines/reference/project/declarationsMultipleTimesImport/node/m4.js +++ b/tests/baselines/reference/project/declarationsMultipleTimesImport/node/m4.js @@ -7,6 +7,7 @@ var d = /** @class */ (function () { }()); exports.d = d; ; +exports.x = void 0; function foo() { return new d(); } diff --git a/tests/baselines/reference/project/declarationsMultipleTimesMultipleImport/amd/m4.js b/tests/baselines/reference/project/declarationsMultipleTimesMultipleImport/amd/m4.js index 24e2e443bfe..eaaad1d5f7c 100644 --- a/tests/baselines/reference/project/declarationsMultipleTimesMultipleImport/amd/m4.js +++ b/tests/baselines/reference/project/declarationsMultipleTimesMultipleImport/amd/m4.js @@ -8,6 +8,7 @@ define(["require", "exports"], function (require, exports) { }()); exports.d = d; ; + exports.x = void 0; function foo() { return new d(); } diff --git a/tests/baselines/reference/project/declarationsMultipleTimesMultipleImport/node/m4.js b/tests/baselines/reference/project/declarationsMultipleTimesMultipleImport/node/m4.js index 7a8d072b08d..fb8354c309b 100644 --- a/tests/baselines/reference/project/declarationsMultipleTimesMultipleImport/node/m4.js +++ b/tests/baselines/reference/project/declarationsMultipleTimesMultipleImport/node/m4.js @@ -7,6 +7,7 @@ var d = /** @class */ (function () { }()); exports.d = d; ; +exports.x = void 0; function foo() { return new d(); } diff --git a/tests/baselines/reference/project/declarationsSimpleImport/amd/m4.js b/tests/baselines/reference/project/declarationsSimpleImport/amd/m4.js index 24e2e443bfe..eaaad1d5f7c 100644 --- a/tests/baselines/reference/project/declarationsSimpleImport/amd/m4.js +++ b/tests/baselines/reference/project/declarationsSimpleImport/amd/m4.js @@ -8,6 +8,7 @@ define(["require", "exports"], function (require, exports) { }()); exports.d = d; ; + exports.x = void 0; function foo() { return new d(); } diff --git a/tests/baselines/reference/project/declarationsSimpleImport/node/m4.js b/tests/baselines/reference/project/declarationsSimpleImport/node/m4.js index 7a8d072b08d..fb8354c309b 100644 --- a/tests/baselines/reference/project/declarationsSimpleImport/node/m4.js +++ b/tests/baselines/reference/project/declarationsSimpleImport/node/m4.js @@ -7,6 +7,7 @@ var d = /** @class */ (function () { }()); exports.d = d; ; +exports.x = void 0; function foo() { return new d(); } diff --git a/tests/baselines/reference/protoAsIndexInIndexExpression.js b/tests/baselines/reference/protoAsIndexInIndexExpression.js index d0d2eb52f78..502033c42bb 100644 --- a/tests/baselines/reference/protoAsIndexInIndexExpression.js +++ b/tests/baselines/reference/protoAsIndexInIndexExpression.js @@ -22,6 +22,7 @@ class C { //// [protoAsIndexInIndexExpression_0.js] "use strict"; exports.__esModule = true; +exports.x = void 0; //// [protoAsIndexInIndexExpression_1.js] /// var EntityPrototype = undefined; diff --git a/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType1.js b/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType1.js index 151c719e0bd..2beadbb5933 100644 --- a/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType1.js +++ b/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType1.js @@ -30,4 +30,5 @@ define(["require", "exports"], function (require, exports) { define(["require", "exports"], function (require, exports) { "use strict"; exports.__esModule = true; + exports.b = void 0; // This should result in type ClassB }); diff --git a/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType2.js b/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType2.js index 3ef3cc597f5..b64dca267e9 100644 --- a/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType2.js +++ b/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType2.js @@ -34,4 +34,5 @@ define(["require", "exports"], function (require, exports) { define(["require", "exports"], function (require, exports) { "use strict"; exports.__esModule = true; + exports.b = void 0; // This should result in type ClassB }); diff --git a/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType3.js b/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType3.js index 53ad4b53464..a74c6c04ba0 100644 --- a/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType3.js +++ b/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType3.js @@ -38,4 +38,5 @@ define(["require", "exports"], function (require, exports) { define(["require", "exports"], function (require, exports) { "use strict"; exports.__esModule = true; + exports.b = void 0; // This should result in type ClassB }); diff --git a/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType4.js b/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType4.js index 2ab16bea5ba..bf4e487253a 100644 --- a/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType4.js +++ b/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType4.js @@ -32,4 +32,5 @@ define(["require", "exports"], function (require, exports) { define(["require", "exports"], function (require, exports) { "use strict"; exports.__esModule = true; + exports.b = void 0; // This should result in type ClassB }); diff --git a/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType5.js b/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType5.js index 2fd84905632..376ed58b588 100644 --- a/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType5.js +++ b/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType5.js @@ -41,4 +41,5 @@ define(["require", "exports"], function (require, exports) { define(["require", "exports"], function (require, exports) { "use strict"; exports.__esModule = true; + exports.b = void 0; // This should result in type ClassB }); diff --git a/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType6.js b/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType6.js index 6d5cc60f5e4..6c28ccc9cb4 100644 --- a/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType6.js +++ b/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType6.js @@ -50,4 +50,5 @@ define(["require", "exports"], function (require, exports) { define(["require", "exports"], function (require, exports) { "use strict"; exports.__esModule = true; + exports.b = void 0; // This should result in type ClassB }); diff --git a/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType7.js b/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType7.js index c4bc8804f60..36dd00cc36f 100644 --- a/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType7.js +++ b/tests/baselines/reference/recursiveExportAssignmentAndFindAliasedType7.js @@ -52,4 +52,5 @@ define(["require", "exports"], function (require, exports) { define(["require", "exports"], function (require, exports) { "use strict"; exports.__esModule = true; + exports.b = void 0; // This should result in type ClassB }); diff --git a/tests/baselines/reference/spellingSuggestionLeadingUnderscores01.js b/tests/baselines/reference/spellingSuggestionLeadingUnderscores01.js index 6a84749b153..1abb0b71ea1 100644 --- a/tests/baselines/reference/spellingSuggestionLeadingUnderscores01.js +++ b/tests/baselines/reference/spellingSuggestionLeadingUnderscores01.js @@ -21,6 +21,8 @@ b = { "use strict"; exports.__esModule = true; exports.a.___foo; +// @filename def.ts +exports.b = void 0; exports.b = { ___foo: 100 }; diff --git a/tests/baselines/reference/thisInClassBodyStaticESNext.js b/tests/baselines/reference/thisInClassBodyStaticESNext.js new file mode 100644 index 00000000000..915ae5e67d0 --- /dev/null +++ b/tests/baselines/reference/thisInClassBodyStaticESNext.js @@ -0,0 +1,23 @@ +//// [thisInClassBodyStaticESNext.ts] +// all are allowed with es-compliant class field emit +class Foo { + x = this + static t = this + static at = () => this + static ft = function () { return this } + static mt() { return this } +} + + +//// [thisInClassBodyStaticESNext.js] +// all are allowed with es-compliant class field emit +const Foo = /** @class */ (() => { + class Foo { + x = this; + static t = this; + static at = () => this; + static ft = function () { return this; }; + static mt() { return this; } + } + return Foo; +})(); diff --git a/tests/baselines/reference/thisInClassBodyStaticESNext.symbols b/tests/baselines/reference/thisInClassBodyStaticESNext.symbols new file mode 100644 index 00000000000..7dc9767ccdf --- /dev/null +++ b/tests/baselines/reference/thisInClassBodyStaticESNext.symbols @@ -0,0 +1,25 @@ +=== tests/cases/compiler/thisInClassBodyStaticESNext.ts === +// all are allowed with es-compliant class field emit +class Foo { +>Foo : Symbol(Foo, Decl(thisInClassBodyStaticESNext.ts, 0, 0)) + + x = this +>x : Symbol(Foo.x, Decl(thisInClassBodyStaticESNext.ts, 1, 11)) +>this : Symbol(Foo, Decl(thisInClassBodyStaticESNext.ts, 0, 0)) + + static t = this +>t : Symbol(Foo.t, Decl(thisInClassBodyStaticESNext.ts, 2, 12)) +>this : Symbol(Foo, Decl(thisInClassBodyStaticESNext.ts, 0, 0)) + + static at = () => this +>at : Symbol(Foo.at, Decl(thisInClassBodyStaticESNext.ts, 3, 19)) +>this : Symbol(Foo, Decl(thisInClassBodyStaticESNext.ts, 0, 0)) + + static ft = function () { return this } +>ft : Symbol(Foo.ft, Decl(thisInClassBodyStaticESNext.ts, 4, 26)) + + static mt() { return this } +>mt : Symbol(Foo.mt, Decl(thisInClassBodyStaticESNext.ts, 5, 43)) +>this : Symbol(Foo, Decl(thisInClassBodyStaticESNext.ts, 0, 0)) +} + diff --git a/tests/baselines/reference/thisInClassBodyStaticESNext.types b/tests/baselines/reference/thisInClassBodyStaticESNext.types new file mode 100644 index 00000000000..152e3a0748a --- /dev/null +++ b/tests/baselines/reference/thisInClassBodyStaticESNext.types @@ -0,0 +1,28 @@ +=== tests/cases/compiler/thisInClassBodyStaticESNext.ts === +// all are allowed with es-compliant class field emit +class Foo { +>Foo : Foo + + x = this +>x : this +>this : this + + static t = this +>t : typeof Foo +>this : typeof Foo + + static at = () => this +>at : () => typeof Foo +>() => this : () => typeof Foo +>this : typeof Foo + + static ft = function () { return this } +>ft : () => any +>function () { return this } : () => any +>this : any + + static mt() { return this } +>mt : () => typeof Foo +>this : typeof Foo +} + diff --git a/tests/baselines/reference/topLevelFileModule.js b/tests/baselines/reference/topLevelFileModule.js index 8ff74cc89f4..83b1a338af0 100644 --- a/tests/baselines/reference/topLevelFileModule.js +++ b/tests/baselines/reference/topLevelFileModule.js @@ -15,6 +15,7 @@ var z = foo.x + fum.y; //// [foo_0.js] "use strict"; exports.__esModule = true; +exports.x = void 0; //// [foo_1.js] "use strict"; exports.__esModule = true; diff --git a/tests/baselines/reference/tsc/composite/initial-build/when-setting-composite-false-and-tsbuildinfo-as-null-on-command-line-but-has-tsbuild-info-in-config.js b/tests/baselines/reference/tsc/composite/initial-build/when-setting-composite-false-and-tsbuildinfo-as-null-on-command-line-but-has-tsbuild-info-in-config.js new file mode 100644 index 00000000000..8b1e90d965b --- /dev/null +++ b/tests/baselines/reference/tsc/composite/initial-build/when-setting-composite-false-and-tsbuildinfo-as-null-on-command-line-but-has-tsbuild-info-in-config.js @@ -0,0 +1,11 @@ +//// [/lib/initial-buildOutput.txt] +/lib/tsc --composite false --p src/project --tsBuildInfoFile null +exitCode:: ExitStatus.Success + + +//// [/src/project/src/main.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.x = 10; + + diff --git a/tests/baselines/reference/tsc/composite/initial-build/when-setting-composite-false-on-command-line-but-has-tsbuild-info-in-config.js b/tests/baselines/reference/tsc/composite/initial-build/when-setting-composite-false-on-command-line-but-has-tsbuild-info-in-config.js new file mode 100644 index 00000000000..dc7ed0590b7 --- /dev/null +++ b/tests/baselines/reference/tsc/composite/initial-build/when-setting-composite-false-on-command-line-but-has-tsbuild-info-in-config.js @@ -0,0 +1,12 @@ +//// [/lib/initial-buildOutput.txt] +/lib/tsc --composite false --p src/project +src/project/tsconfig.json(6,9): error TS5069: Option 'tsBuildInfoFile' cannot be specified without specifying option 'incremental' or option 'composite'. +exitCode:: ExitStatus.DiagnosticsPresent_OutputsGenerated + + +//// [/src/project/src/main.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.x = 10; + + diff --git a/tests/baselines/reference/tsc/composite/initial-build/when-setting-composite-false-on-command-line.js b/tests/baselines/reference/tsc/composite/initial-build/when-setting-composite-false-on-command-line.js new file mode 100644 index 00000000000..878fe45b3ff --- /dev/null +++ b/tests/baselines/reference/tsc/composite/initial-build/when-setting-composite-false-on-command-line.js @@ -0,0 +1,11 @@ +//// [/lib/initial-buildOutput.txt] +/lib/tsc --composite false --p src/project +exitCode:: ExitStatus.Success + + +//// [/src/project/src/main.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.x = 10; + + diff --git a/tests/baselines/reference/tsc/composite/initial-build/when-setting-composite-null-on-command-line.js b/tests/baselines/reference/tsc/composite/initial-build/when-setting-composite-null-on-command-line.js new file mode 100644 index 00000000000..c30cd727af7 --- /dev/null +++ b/tests/baselines/reference/tsc/composite/initial-build/when-setting-composite-null-on-command-line.js @@ -0,0 +1,11 @@ +//// [/lib/initial-buildOutput.txt] +/lib/tsc --composite null --p src/project +exitCode:: ExitStatus.Success + + +//// [/src/project/src/main.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.x = 10; + + diff --git a/tests/baselines/reference/tscWatch/emit/emit-for-configured-projects/should-always-return-the-file-itself-if-'--isolatedModules'-is-specified.js b/tests/baselines/reference/tscWatch/emit/emit-for-configured-projects/should-always-return-the-file-itself-if-'--isolatedModules'-is-specified.js index e9c1caed5aa..3b53157eaf8 100644 --- a/tests/baselines/reference/tscWatch/emit/emit-for-configured-projects/should-always-return-the-file-itself-if-'--isolatedModules'-is-specified.js +++ b/tests/baselines/reference/tscWatch/emit/emit-for-configured-projects/should-always-return-the-file-itself-if-'--isolatedModules'-is-specified.js @@ -120,7 +120,15 @@ Change:: Change the content of moduleFile1 to `export var T: number;export funct //// [/a/b/moduleFile1.ts] export var T: number;export function Foo() { }; -//// [/a/b/moduleFile1.js] file written with same contents +//// [/a/b/moduleFile1.js] +"use strict"; +exports.__esModule = true; +exports.T = void 0; +function Foo() { } +exports.Foo = Foo; +; + + Output:: >> Screen clear diff --git a/tests/baselines/reference/tscWatch/emit/emit-for-configured-projects/should-be-up-to-date-with-deleted-files.js b/tests/baselines/reference/tscWatch/emit/emit-for-configured-projects/should-be-up-to-date-with-deleted-files.js index d924bddf55c..beca4999867 100644 --- a/tests/baselines/reference/tscWatch/emit/emit-for-configured-projects/should-be-up-to-date-with-deleted-files.js +++ b/tests/baselines/reference/tscWatch/emit/emit-for-configured-projects/should-be-up-to-date-with-deleted-files.js @@ -118,7 +118,15 @@ Change:: change moduleFile1 shape and delete file1Consumer2 //// [/a/b/moduleFile1.ts] export var T: number;export function Foo() { }; -//// [/a/b/moduleFile1.js] file written with same contents +//// [/a/b/moduleFile1.js] +"use strict"; +exports.__esModule = true; +exports.T = void 0; +function Foo() { } +exports.Foo = Foo; +; + + //// [/a/b/file1Consumer1.js] file written with same contents //// [/a/b/file1Consumer2.ts] deleted diff --git a/tests/baselines/reference/tscWatch/emit/emit-for-configured-projects/should-be-up-to-date-with-newly-created-files.js b/tests/baselines/reference/tscWatch/emit/emit-for-configured-projects/should-be-up-to-date-with-newly-created-files.js index d764b6c3960..0cbc827fd18 100644 --- a/tests/baselines/reference/tscWatch/emit/emit-for-configured-projects/should-be-up-to-date-with-newly-created-files.js +++ b/tests/baselines/reference/tscWatch/emit/emit-for-configured-projects/should-be-up-to-date-with-newly-created-files.js @@ -118,7 +118,15 @@ Change:: change moduleFile1 shape and create file1Consumer3 //// [/a/b/moduleFile1.ts] export var T: number;export function Foo() { }; -//// [/a/b/moduleFile1.js] file written with same contents +//// [/a/b/moduleFile1.js] +"use strict"; +exports.__esModule = true; +exports.T = void 0; +function Foo() { } +exports.Foo = Foo; +; + + //// [/a/b/file1Consumer1.js] file written with same contents //// [/a/b/file1Consumer2.js] file written with same contents //// [/a/b/file1Consumer3.ts] diff --git a/tests/baselines/reference/tscWatch/emit/emit-for-configured-projects/should-be-up-to-date-with-the-reference-map-changes.js b/tests/baselines/reference/tscWatch/emit/emit-for-configured-projects/should-be-up-to-date-with-the-reference-map-changes.js index a12af63e94a..c45888616d3 100644 --- a/tests/baselines/reference/tscWatch/emit/emit-for-configured-projects/should-be-up-to-date-with-the-reference-map-changes.js +++ b/tests/baselines/reference/tscWatch/emit/emit-for-configured-projects/should-be-up-to-date-with-the-reference-map-changes.js @@ -180,7 +180,15 @@ Change:: Change the content of moduleFile1 to `export var T: number;export funct //// [/a/b/moduleFile1.ts] export var T: number;export function Foo() { }; -//// [/a/b/moduleFile1.js] file written with same contents +//// [/a/b/moduleFile1.js] +"use strict"; +exports.__esModule = true; +exports.T = void 0; +function Foo() { } +exports.Foo = Foo; +; + + //// [/a/b/file1Consumer2.js] file written with same contents Output:: @@ -374,6 +382,7 @@ export var T: number;export function Foo() { }; //// [/a/b/moduleFile1.js] "use strict"; exports.__esModule = true; +exports.T = void 0; function Foo() { } exports.Foo = Foo; ; diff --git a/tests/baselines/reference/tscWatch/emit/emit-for-configured-projects/should-contains-only-itself-if-a-module-file's-shape-didn't-change,-and-all-files-referencing-it-if-its-shape-changed.js b/tests/baselines/reference/tscWatch/emit/emit-for-configured-projects/should-contains-only-itself-if-a-module-file's-shape-didn't-change,-and-all-files-referencing-it-if-its-shape-changed.js index 96a98ca1494..77e20bfec1b 100644 --- a/tests/baselines/reference/tscWatch/emit/emit-for-configured-projects/should-contains-only-itself-if-a-module-file's-shape-didn't-change,-and-all-files-referencing-it-if-its-shape-changed.js +++ b/tests/baselines/reference/tscWatch/emit/emit-for-configured-projects/should-contains-only-itself-if-a-module-file's-shape-didn't-change,-and-all-files-referencing-it-if-its-shape-changed.js @@ -118,7 +118,15 @@ Change:: Change the content of moduleFile1 to `export var T: number;export funct //// [/a/b/moduleFile1.ts] export var T: number;export function Foo() { }; -//// [/a/b/moduleFile1.js] file written with same contents +//// [/a/b/moduleFile1.js] +"use strict"; +exports.__esModule = true; +exports.T = void 0; +function Foo() { } +exports.Foo = Foo; +; + + //// [/a/b/file1Consumer1.js] file written with same contents //// [/a/b/file1Consumer2.js] file written with same contents @@ -180,6 +188,7 @@ export var T: number;export function Foo() { console.log('hi'); }; //// [/a/b/moduleFile1.js] "use strict"; exports.__esModule = true; +exports.T = void 0; function Foo() { console.log('hi'); } exports.Foo = Foo; ; diff --git a/tests/baselines/reference/tscWatch/emit/emit-for-configured-projects/should-detect-changes-in-non-root-files.js b/tests/baselines/reference/tscWatch/emit/emit-for-configured-projects/should-detect-changes-in-non-root-files.js index b127003dbc2..2606b0f2579 100644 --- a/tests/baselines/reference/tscWatch/emit/emit-for-configured-projects/should-detect-changes-in-non-root-files.js +++ b/tests/baselines/reference/tscWatch/emit/emit-for-configured-projects/should-detect-changes-in-non-root-files.js @@ -89,7 +89,15 @@ Change:: Change the content of moduleFile1 to `export var T: number;export funct //// [/a/b/moduleFile1.ts] export var T: number;export function Foo() { }; -//// [/a/b/moduleFile1.js] file written with same contents +//// [/a/b/moduleFile1.js] +"use strict"; +exports.__esModule = true; +exports.T = void 0; +function Foo() { } +exports.Foo = Foo; +; + + //// [/a/b/file1Consumer1.js] file written with same contents Output:: @@ -138,6 +146,7 @@ export var T: number;export function Foo() { };var T1: number; //// [/a/b/moduleFile1.js] "use strict"; exports.__esModule = true; +exports.T = void 0; function Foo() { } exports.Foo = Foo; ; diff --git a/tests/baselines/reference/tscWatch/emit/emit-for-configured-projects/should-return-cascaded-affected-file-list.js b/tests/baselines/reference/tscWatch/emit/emit-for-configured-projects/should-return-cascaded-affected-file-list.js index 7bce15e9b59..0142035e916 100644 --- a/tests/baselines/reference/tscWatch/emit/emit-for-configured-projects/should-return-cascaded-affected-file-list.js +++ b/tests/baselines/reference/tscWatch/emit/emit-for-configured-projects/should-return-cascaded-affected-file-list.js @@ -130,7 +130,13 @@ Change:: change file1Consumer1 //// [/a/b/file1Consumer1.ts] import {Foo} from "./moduleFile1"; export var y = 10;export var T: number; -//// [/a/b/file1Consumer1.js] file written with same contents +//// [/a/b/file1Consumer1.js] +"use strict"; +exports.__esModule = true; +exports.y = 10; +exports.T = void 0; + + //// [/a/b/file1Consumer1Consumer1.js] file written with same contents Output:: @@ -190,7 +196,15 @@ Change:: Change the content of moduleFile1 to `export var T: number;export funct //// [/a/b/moduleFile1.ts] export var T: number;export function Foo() { }; -//// [/a/b/moduleFile1.js] file written with same contents +//// [/a/b/moduleFile1.js] +"use strict"; +exports.__esModule = true; +exports.T = void 0; +function Foo() { } +exports.Foo = Foo; +; + + //// [/a/b/file1Consumer1.js] file written with same contents //// [/a/b/file1Consumer2.js] file written with same contents @@ -255,8 +269,23 @@ export var T2: number;export function Foo() { }; //// [/a/b/file1Consumer1.ts] import {Foo} from "./moduleFile1"; export var y = 10;export var T: number;export var T2: number; -//// [/a/b/moduleFile1.js] file written with same contents -//// [/a/b/file1Consumer1.js] file written with same contents +//// [/a/b/moduleFile1.js] +"use strict"; +exports.__esModule = true; +exports.T2 = void 0; +function Foo() { } +exports.Foo = Foo; +; + + +//// [/a/b/file1Consumer1.js] +"use strict"; +exports.__esModule = true; +exports.y = 10; +exports.T = void 0; +exports.T2 = void 0; + + //// [/a/b/file1Consumer1Consumer1.js] file written with same contents //// [/a/b/file1Consumer2.js] file written with same contents diff --git a/tests/baselines/reference/typeGuardsInExternalModule.js b/tests/baselines/reference/typeGuardsInExternalModule.js index 03f2d2cee8d..c4eae3d6bf4 100644 --- a/tests/baselines/reference/typeGuardsInExternalModule.js +++ b/tests/baselines/reference/typeGuardsInExternalModule.js @@ -39,6 +39,7 @@ else { } // exported variable in external module var strOrNum; +exports.var2 = void 0; if (typeof exports.var2 === "string") { // export makes the var property and not variable strOrNum = exports.var2; // string | number diff --git a/tests/baselines/reference/typeReferenceDirectives7.js b/tests/baselines/reference/typeReferenceDirectives7.js index 7be0651a581..7170fef98b6 100644 --- a/tests/baselines/reference/typeReferenceDirectives7.js +++ b/tests/baselines/reference/typeReferenceDirectives7.js @@ -19,6 +19,7 @@ export let y = () => x /// exports.__esModule = true; exports.$ = 1; +exports.x = void 0; exports.y = function () { return exports.x; }; diff --git a/tests/baselines/reference/typeofANonExportedType.js b/tests/baselines/reference/typeofANonExportedType.js index 97edc2d0922..e51c2f490d2 100644 --- a/tests/baselines/reference/typeofANonExportedType.js +++ b/tests/baselines/reference/typeofANonExportedType.js @@ -55,14 +55,23 @@ export var r13: typeof foo; "use strict"; exports.__esModule = true; var x = 1; +exports.r1 = void 0; var y = { foo: '' }; +exports.r2 = void 0; var C = /** @class */ (function () { function C() { } return C; }()); +exports.c = void 0; var c2; +exports.r3 = void 0; +exports.r4 = void 0; +exports.r4b = void 0; +exports.i = void 0; var i2; +exports.r5 = void 0; +exports.r5 = void 0; var M; (function (M) { M.foo = ''; @@ -73,10 +82,17 @@ var M; }()); M.C = C; })(M || (M = {})); +exports.r6 = void 0; +exports.r7 = void 0; +exports.r8 = void 0; +exports.r9 = void 0; var E; (function (E) { E[E["A"] = 0] = "A"; })(E || (E = {})); +exports.r10 = void 0; +exports.r11 = void 0; +exports.r12 = void 0; function foo() { } (function (foo) { foo.y = 1; @@ -87,3 +103,4 @@ function foo() { } }()); foo.C = C; })(foo || (foo = {})); +exports.r13 = void 0; diff --git a/tests/baselines/reference/typeofAnExportedType.js b/tests/baselines/reference/typeofAnExportedType.js index 54d1e85c32c..ac4dc20edb3 100644 --- a/tests/baselines/reference/typeofAnExportedType.js +++ b/tests/baselines/reference/typeofAnExportedType.js @@ -55,15 +55,24 @@ export var r13: typeof foo; "use strict"; exports.__esModule = true; exports.x = 1; +exports.r1 = void 0; exports.y = { foo: '' }; +exports.r2 = void 0; var C = /** @class */ (function () { function C() { } return C; }()); exports.C = C; +exports.c = void 0; var c2; +exports.r3 = void 0; +exports.r4 = void 0; +exports.r4b = void 0; +exports.i = void 0; var i2; +exports.r5 = void 0; +exports.r5 = void 0; var M; (function (M) { M.foo = ''; @@ -74,11 +83,18 @@ var M; }()); M.C = C; })(M = exports.M || (exports.M = {})); +exports.r6 = void 0; +exports.r7 = void 0; exports.Z = M; +exports.r8 = void 0; +exports.r9 = void 0; var E; (function (E) { E[E["A"] = 0] = "A"; })(E = exports.E || (exports.E = {})); +exports.r10 = void 0; +exports.r11 = void 0; +exports.r12 = void 0; function foo() { } exports.foo = foo; (function (foo) { @@ -90,3 +106,4 @@ exports.foo = foo; }()); foo.C = C; })(foo = exports.foo || (exports.foo = {})); +exports.r13 = void 0; diff --git a/tests/baselines/reference/umd-errors.js b/tests/baselines/reference/umd-errors.js index 2c9fbd809e1..87f44fea791 100644 --- a/tests/baselines/reference/umd-errors.js +++ b/tests/baselines/reference/umd-errors.js @@ -34,3 +34,5 @@ export as namespace C2; //// [err5.js] "use strict"; exports.__esModule = true; +// Illegal, may not appear in implementation files +exports.v = void 0; diff --git a/tests/baselines/reference/unusedVariablesinModules1.js b/tests/baselines/reference/unusedVariablesinModules1.js index 474145c6336..91606bc1517 100644 --- a/tests/baselines/reference/unusedVariablesinModules1.js +++ b/tests/baselines/reference/unusedVariablesinModules1.js @@ -9,3 +9,4 @@ export var y: string; "use strict"; exports.__esModule = true; var x; +exports.y = void 0; diff --git a/tests/baselines/reference/withExportDecl.js b/tests/baselines/reference/withExportDecl.js index 97d528ecd62..ff26e8f2c68 100644 --- a/tests/baselines/reference/withExportDecl.js +++ b/tests/baselines/reference/withExportDecl.js @@ -63,6 +63,7 @@ define(["require", "exports"], function (require, exports) { "use strict"; exports.__esModule = true; var simpleVar; + exports.exportedSimpleVar = void 0; var anotherVar; var varWithSimpleType; var varWithArrayType; @@ -71,6 +72,7 @@ define(["require", "exports"], function (require, exports) { var withComplicatedValue = { x: 30, y: 70, desc: "position" }; exports.exportedWithComplicatedValue = { x: 30, y: 70, desc: "position" }; var arrayVar = ['a', 'b']; + exports.exportedArrayVar = void 0; exports.exportedArrayVar.push({ x: 30, y: 'hello world' }); function simpleFunction() { return { @@ -97,9 +99,9 @@ define(["require", "exports"], function (require, exports) { } m3.foo = foo; })(m3 = exports.m3 || (exports.m3 = {})); - exports.eVar2 = 10; + exports.eVar1 = void 0, exports.eVar2 = 10; var eVar22; - exports.eVar3 = 10; + exports.eVar3 = 10, exports.eVar4 = void 0, exports.eVar5 = void 0; }); diff --git a/tests/cases/compiler/circularOptionalityRemoval.ts b/tests/cases/compiler/circularOptionalityRemoval.ts new file mode 100644 index 00000000000..20a6a408570 --- /dev/null +++ b/tests/cases/compiler/circularOptionalityRemoval.ts @@ -0,0 +1,7 @@ +// @strictNullChecks: true + +// Constructed repro +function fn1(x: number | undefined = x > 0 ? x : 0) { } + +// Report from user +function fn2(x?: string = someCondition ? 'value1' : x) { } \ No newline at end of file diff --git a/tests/cases/compiler/thisInClassBodyStaticESNext.ts b/tests/cases/compiler/thisInClassBodyStaticESNext.ts new file mode 100644 index 00000000000..ae72e6f0bde --- /dev/null +++ b/tests/cases/compiler/thisInClassBodyStaticESNext.ts @@ -0,0 +1,11 @@ +// @target: esnext +// @useDefineForClassFields: true + +// all are allowed with es-compliant class field emit +class Foo { + x = this + static t = this + static at = () => this + static ft = function () { return this } + static mt() { return this } +}