Merge branch 'master' into promisesAndUnderscores

This commit is contained in:
Benjamin Lichtman 2018-09-17 16:43:08 -07:00 committed by GitHub
commit 0cb9fd62ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
69 changed files with 12798 additions and 10428 deletions

View File

@ -2465,7 +2465,7 @@ namespace ts {
node.left.parent = node;
node.right.parent = node;
const lhs = node.left as PropertyAccessEntityNameExpression;
bindPropertyAssignment(lhs, lhs, /*isPrototypeProperty*/ false);
bindPropertyAssignment(lhs.expression, lhs, /*isPrototypeProperty*/ false);
}
/**
@ -2522,7 +2522,7 @@ namespace ts {
const isToplevel = isBinaryExpression(propertyAccess.parent)
? getParentOfBinaryExpression(propertyAccess.parent).parent.kind === SyntaxKind.SourceFile
: propertyAccess.parent.parent.kind === SyntaxKind.SourceFile;
if (!isPrototypeProperty && (!namespaceSymbol || !(namespaceSymbol.flags & SymbolFlags.Namespace)) && isToplevel) {
if (isToplevel && !isPrototypeProperty && (!namespaceSymbol || !(namespaceSymbol.flags & SymbolFlags.Namespace))) {
// make symbols or add declarations for intermediate containers
const flags = SymbolFlags.Module | SymbolFlags.Assignment;
const excludeFlags = SymbolFlags.ValueModuleExcludes & ~SymbolFlags.Assignment;

View File

@ -88,7 +88,7 @@ namespace ts.BuilderState {
function getReferencedFileFromImportedModuleSymbol(symbol: Symbol) {
if (symbol.declarations && symbol.declarations[0]) {
const declarationSourceFile = getSourceFileOfNode(symbol.declarations[0]);
return declarationSourceFile && declarationSourceFile.path;
return declarationSourceFile && (declarationSourceFile.resolvedPath || declarationSourceFile.path);
}
}
@ -100,6 +100,13 @@ namespace ts.BuilderState {
return symbol && getReferencedFileFromImportedModuleSymbol(symbol);
}
/**
* Gets the path to reference file from file name, it could be resolvedPath if present otherwise path
*/
function getReferencedFileFromFileName(program: Program, fileName: string, sourceFileDirectory: Path, getCanonicalFileName: GetCanonicalFileName): Path {
return toPath(program.getProjectReferenceRedirect(fileName) || fileName, sourceFileDirectory, getCanonicalFileName);
}
/**
* Gets the referenced files for a file from the program with values for the keys as referenced file's path to be true
*/
@ -123,7 +130,7 @@ namespace ts.BuilderState {
// Handle triple slash references
if (sourceFile.referencedFiles && sourceFile.referencedFiles.length > 0) {
for (const referencedFile of sourceFile.referencedFiles) {
const referencedPath = toPath(referencedFile.fileName, sourceFileDirectory, getCanonicalFileName);
const referencedPath = getReferencedFileFromFileName(program, referencedFile.fileName, sourceFileDirectory, getCanonicalFileName);
addReferencedFile(referencedPath);
}
}
@ -136,7 +143,7 @@ namespace ts.BuilderState {
}
const fileName = resolvedTypeReferenceDirective.resolvedFileName!; // TODO: GH#18217
const typeFilePath = toPath(fileName, sourceFileDirectory, getCanonicalFileName);
const typeFilePath = getReferencedFileFromFileName(program, fileName, sourceFileDirectory, getCanonicalFileName);
addReferencedFile(typeFilePath);
});
}

View File

@ -640,7 +640,7 @@ namespace ts {
const identityRelation = createMap<RelationComparisonResult>();
const enumRelation = createMap<RelationComparisonResult>();
type TypeSystemEntity = Symbol | Type | Signature;
type TypeSystemEntity = Node | Symbol | Type | Signature;
const enum TypeSystemPropertyName {
Type,
@ -648,6 +648,7 @@ namespace ts {
DeclaredType,
ResolvedReturnType,
ImmediateBaseConstraint,
EnumTagType,
}
const enum CheckMode {
@ -3470,8 +3471,8 @@ namespace ts {
const arity = getTypeReferenceArity(type);
const tupleConstituentNodes = mapToTypeNodes(typeArguments.slice(0, arity), context);
const hasRestElement = (<TupleType>type.target).hasRestElement;
if (tupleConstituentNodes && tupleConstituentNodes.length > 0) {
for (let i = (<TupleType>type.target).minLength; i < arity; i++) {
if (tupleConstituentNodes) {
for (let i = (<TupleType>type.target).minLength; i < Math.min(arity, tupleConstituentNodes.length); i++) {
tupleConstituentNodes[i] = hasRestElement && i === arity - 1 ?
createRestTypeNode(createArrayTypeNode(tupleConstituentNodes[i])) :
createOptionalTypeNode(tupleConstituentNodes[i]);
@ -4475,6 +4476,8 @@ namespace ts {
switch (propertyName) {
case TypeSystemPropertyName.Type:
return !!getSymbolLinks(<Symbol>target).type;
case TypeSystemPropertyName.EnumTagType:
return !!(getNodeLinks(target as JSDocEnumTag).resolvedEnumType);
case TypeSystemPropertyName.DeclaredType:
return !!getSymbolLinks(<Symbol>target).declaredType;
case TypeSystemPropertyName.ResolvedBaseConstructorType:
@ -8252,9 +8255,18 @@ namespace ts {
}
// JS are 'string' or 'number', not an enum type.
const enumTag = symbol.valueDeclaration && getJSDocEnumTag(symbol.valueDeclaration);
const enumTag = isInJSFile(node) && symbol.valueDeclaration && getJSDocEnumTag(symbol.valueDeclaration);
if (enumTag) {
return enumTag.typeExpression ? getTypeFromTypeNode(enumTag.typeExpression) : errorType;
const links = getNodeLinks(enumTag);
if (!pushTypeResolution(enumTag, TypeSystemPropertyName.EnumTagType)) {
return errorType;
}
let type = enumTag.typeExpression ? getTypeFromTypeNode(enumTag.typeExpression) : errorType;
if (!popTypeResolution()) {
type = errorType;
error(node, Diagnostics.Enum_type_0_circularly_references_itself, symbolToString(symbol));
}
return (links.resolvedEnumType = type);
}
// Get type from reference to named type that cannot be generic (enum or type parameter)
@ -13373,7 +13385,7 @@ namespace ts {
let propagationType: Type;
inferFromTypes(originalSource, originalTarget);
function inferFromTypes(source: Type, target: Type) {
function inferFromTypes(source: Type, target: Type): void {
if (!couldContainTypeVariables(target)) {
return;
}
@ -13508,6 +13520,9 @@ namespace ts {
inferFromTypes(getTrueTypeFromConditionalType(<ConditionalType>source), getTrueTypeFromConditionalType(<ConditionalType>target));
inferFromTypes(getFalseTypeFromConditionalType(<ConditionalType>source), getFalseTypeFromConditionalType(<ConditionalType>target));
}
else if (target.flags & TypeFlags.Conditional) {
inferFromTypes(source, getUnionType([getTrueTypeFromConditionalType(<ConditionalType>target), getFalseTypeFromConditionalType(<ConditionalType>target)]));
}
else if (target.flags & TypeFlags.UnionOrIntersection) {
const targetTypes = (<UnionOrIntersectionType>target).types;
let typeVariableCount = 0;
@ -13541,7 +13556,14 @@ namespace ts {
}
else {
if (!(priority & InferencePriority.NoConstraints && source.flags & (TypeFlags.Intersection | TypeFlags.Instantiable))) {
source = getApparentType(source);
const apparentSource = getApparentType(source);
// getApparentType can return _any_ type, since an indexed access or conditional may simplify to any other type.
// If that occurs and it doesn't simplify to an object or intersection, we'll need to restart `inferFromTypes`
// with the simplified source.
if (apparentSource !== source && !(apparentSource.flags & (TypeFlags.Object | TypeFlags.Intersection))) {
return inferFromTypes(apparentSource, target);
}
source = apparentSource;
}
if (source.flags & (TypeFlags.Object | TypeFlags.Intersection)) {
const key = source.id + "," + target.id;
@ -13747,7 +13769,7 @@ namespace ts {
function hasPrimitiveConstraint(type: TypeParameter): boolean {
const constraint = getConstraintOfTypeParameter(type);
return !!constraint && maybeTypeOfKind(constraint, TypeFlags.Primitive | TypeFlags.Index);
return !!constraint && maybeTypeOfKind(constraint.flags & TypeFlags.Conditional ? getDefaultConstraintOfConditionalType(constraint as ConditionalType) : constraint, TypeFlags.Primitive | TypeFlags.Index);
}
function isObjectLiteralType(type: Type) {
@ -14734,6 +14756,14 @@ namespace ts {
// reference 'x.y.z', we may be at an assignment to 'x.y' or 'x'. In that case,
// return the declared type.
if (containsMatchingReference(reference, node)) {
// A matching dotted name might also be an expando property on a function *expression*,
// in which case we continue control flow analysis back to the function's declaration
if (isVariableDeclaration(node) && (isInJSFile(node) || isVarConst(node))) {
const init = getDeclaredExpandoInitializer(node);
if (init && (init.kind === SyntaxKind.FunctionExpression || init.kind === SyntaxKind.ArrowFunction)) {
return getTypeAtFlowNode(flow.antecedent);
}
}
return declaredType;
}
// Assignment doesn't affect reference
@ -18208,7 +18238,7 @@ namespace ts {
// Referencing abstract properties within their own constructors is not allowed
if ((flags & ModifierFlags.Abstract) && isThisProperty(node) && symbolHasNonMethodDeclaration(prop)) {
const declaringClassDeclaration = getClassLikeDeclarationOfSymbol(getParentOfSymbol(prop)!);
if (declaringClassDeclaration && isNodeUsedDuringClassInitialization(node, declaringClassDeclaration)) {
if (declaringClassDeclaration && isNodeUsedDuringClassInitialization(node)) {
error(errorNode, Diagnostics.Abstract_property_0_in_class_1_cannot_be_accessed_in_the_constructor, symbolToString(prop), getTextOfIdentifierOrLiteral(declaringClassDeclaration.name!)); // TODO: GH#18217
return false;
}
@ -18395,6 +18425,9 @@ namespace ts {
}
}
}
else if (strictNullChecks && prop && prop.valueDeclaration && isPropertyAccessExpression(prop.valueDeclaration) && getAssignmentDeclarationPropertyAccessKind(prop.valueDeclaration)) {
assumeUninitialized = true;
}
const flowType = getFlowTypeOfReference(node, propType, assumeUninitialized ? getOptionalType(propType) : propType);
if (assumeUninitialized && !(getFalsyFlags(propType) & TypeFlags.Undefined) && getFalsyFlags(flowType) & TypeFlags.Undefined) {
error(right, Diagnostics.Property_0_is_used_before_being_assigned, symbolToString(prop!)); // TODO: GH#18217
@ -20192,18 +20225,15 @@ namespace ts {
assigned || inferred;
}
function getAssignedClassType(symbol: Symbol) {
function getAssignedClassType(symbol: Symbol): Type | undefined {
const decl = symbol.valueDeclaration;
const assignmentSymbol = decl && decl.parent &&
(isFunctionDeclaration(decl) && getSymbolOfNode(decl) ||
isBinaryExpression(decl.parent) && getSymbolOfNode(decl.parent.left) ||
isVariableDeclaration(decl.parent) && getSymbolOfNode(decl.parent));
if (assignmentSymbol) {
const prototype = forEach(assignmentSymbol.declarations, getAssignedJSPrototype);
if (prototype) {
return checkExpression(prototype);
}
}
const prototype = assignmentSymbol && assignmentSymbol.exports && assignmentSymbol.exports.get("prototype" as __String);
const init = prototype && getAssignedJSPrototype(prototype.valueDeclaration);
return init ? checkExpression(init) : undefined;
}
function getAssignedJSPrototype(node: Node) {
@ -27419,12 +27449,12 @@ namespace ts {
return result;
}
function isNodeUsedDuringClassInitialization(node: Node, classDeclaration: ClassLikeDeclaration) {
function isNodeUsedDuringClassInitialization(node: Node) {
return !!findAncestor(node, element => {
if ((isConstructorDeclaration(element) && nodeIsPresent(element.body) || isPropertyDeclaration(element)) && element.parent === classDeclaration) {
if (isConstructorDeclaration(element) && nodeIsPresent(element.body) || isPropertyDeclaration(element)) {
return true;
}
else if (element === classDeclaration || isFunctionLikeDeclaration(element)) {
else if (isClassLike(element) || isFunctionLikeDeclaration(element)) {
return "quit";
}

View File

@ -172,6 +172,8 @@ namespace ts {
es2018: ScriptTarget.ES2018,
esnext: ScriptTarget.ESNext,
}),
affectsSourceFile: true,
affectsModuleResolution: true,
paramType: Diagnostics.VERSION,
showInSimplifiedHelpView: true,
category: Diagnostics.Basic_Options,
@ -190,6 +192,7 @@ namespace ts {
es2015: ModuleKind.ES2015,
esnext: ModuleKind.ESNext
}),
affectsModuleResolution: true,
paramType: Diagnostics.KIND,
showInSimplifiedHelpView: true,
category: Diagnostics.Basic_Options,
@ -202,6 +205,7 @@ namespace ts {
name: "lib",
type: libMap
},
affectsModuleResolution: true,
showInSimplifiedHelpView: true,
category: Diagnostics.Basic_Options,
description: Diagnostics.Specify_library_files_to_be_included_in_the_compilation
@ -209,6 +213,7 @@ namespace ts {
{
name: "allowJs",
type: "boolean",
affectsModuleResolution: true,
showInSimplifiedHelpView: true,
category: Diagnostics.Basic_Options,
description: Diagnostics.Allow_javascript_files_to_be_compiled
@ -226,6 +231,7 @@ namespace ts {
"react-native": JsxEmit.ReactNative,
"react": JsxEmit.React
}),
affectsSourceFile: true,
paramType: Diagnostics.KIND,
showInSimplifiedHelpView: true,
category: Diagnostics.Basic_Options,
@ -336,6 +342,7 @@ namespace ts {
{
name: "noImplicitAny",
type: "boolean",
affectsSemanticDiagnostics: true,
strictFlag: true,
showInSimplifiedHelpView: true,
category: Diagnostics.Strict_Type_Checking_Options,
@ -344,6 +351,7 @@ namespace ts {
{
name: "strictNullChecks",
type: "boolean",
affectsSemanticDiagnostics: true,
strictFlag: true,
showInSimplifiedHelpView: true,
category: Diagnostics.Strict_Type_Checking_Options,
@ -352,6 +360,7 @@ namespace ts {
{
name: "strictFunctionTypes",
type: "boolean",
affectsSemanticDiagnostics: true,
strictFlag: true,
showInSimplifiedHelpView: true,
category: Diagnostics.Strict_Type_Checking_Options,
@ -360,6 +369,7 @@ namespace ts {
{
name: "strictPropertyInitialization",
type: "boolean",
affectsSemanticDiagnostics: true,
strictFlag: true,
showInSimplifiedHelpView: true,
category: Diagnostics.Strict_Type_Checking_Options,
@ -368,6 +378,7 @@ namespace ts {
{
name: "noImplicitThis",
type: "boolean",
affectsSemanticDiagnostics: true,
strictFlag: true,
showInSimplifiedHelpView: true,
category: Diagnostics.Strict_Type_Checking_Options,
@ -376,6 +387,7 @@ namespace ts {
{
name: "alwaysStrict",
type: "boolean",
affectsSourceFile: true,
strictFlag: true,
showInSimplifiedHelpView: true,
category: Diagnostics.Strict_Type_Checking_Options,
@ -410,6 +422,7 @@ namespace ts {
{
name: "noFallthroughCasesInSwitch",
type: "boolean",
affectsBindDiagnostics: true,
affectsSemanticDiagnostics: true,
showInSimplifiedHelpView: true,
category: Diagnostics.Additional_Checks,
@ -423,6 +436,7 @@ namespace ts {
node: ModuleResolutionKind.NodeJs,
classic: ModuleResolutionKind.Classic,
}),
affectsModuleResolution: true,
paramType: Diagnostics.STRATEGY,
category: Diagnostics.Module_Resolution_Options,
description: Diagnostics.Specify_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6,
@ -430,6 +444,7 @@ namespace ts {
{
name: "baseUrl",
type: "string",
affectsModuleResolution: true,
isFilePath: true,
category: Diagnostics.Module_Resolution_Options,
description: Diagnostics.Base_directory_to_resolve_non_absolute_module_names
@ -439,6 +454,7 @@ namespace ts {
// use type = object to copy the value as-is
name: "paths",
type: "object",
affectsModuleResolution: true,
isTSConfigOnly: true,
category: Diagnostics.Module_Resolution_Options,
description: Diagnostics.A_series_of_entries_which_re_map_imports_to_lookup_locations_relative_to_the_baseUrl
@ -454,6 +470,7 @@ namespace ts {
type: "string",
isFilePath: true
},
affectsModuleResolution: true,
category: Diagnostics.Module_Resolution_Options,
description: Diagnostics.List_of_root_folders_whose_combined_content_represents_the_structure_of_the_project_at_runtime
},
@ -465,6 +482,7 @@ namespace ts {
type: "string",
isFilePath: true
},
affectsModuleResolution: true,
category: Diagnostics.Module_Resolution_Options,
description: Diagnostics.List_of_folders_to_include_type_definitions_from
},
@ -475,6 +493,7 @@ namespace ts {
name: "types",
type: "string"
},
affectsModuleResolution: true,
showInSimplifiedHelpView: true,
category: Diagnostics.Module_Resolution_Options,
description: Diagnostics.Type_declaration_files_to_be_included_in_compilation
@ -633,12 +652,14 @@ namespace ts {
{
name: "noLib",
type: "boolean",
affectsModuleResolution: true,
category: Diagnostics.Advanced_Options,
description: Diagnostics.Do_not_include_the_default_library_file_lib_d_ts
},
{
name: "noResolve",
type: "boolean",
affectsModuleResolution: true,
category: Diagnostics.Advanced_Options,
description: Diagnostics.Do_not_add_triple_slash_references_or_imported_modules_to_the_list_of_compiled_files
},
@ -651,6 +672,7 @@ namespace ts {
{
name: "disableSizeLimit",
type: "boolean",
affectsSourceFile: true,
category: Diagnostics.Advanced_Options,
description: Diagnostics.Disable_size_limitations_on_JavaScript_projects
},
@ -696,6 +718,7 @@ namespace ts {
{
name: "allowUnusedLabels",
type: "boolean",
affectsBindDiagnostics: true,
affectsSemanticDiagnostics: true,
category: Diagnostics.Advanced_Options,
description: Diagnostics.Do_not_report_errors_on_unused_labels
@ -703,6 +726,7 @@ namespace ts {
{
name: "allowUnreachableCode",
type: "boolean",
affectsBindDiagnostics: true,
affectsSemanticDiagnostics: true,
category: Diagnostics.Advanced_Options,
description: Diagnostics.Do_not_report_errors_on_unreachable_code
@ -730,6 +754,7 @@ namespace ts {
{
name: "maxNodeModuleJsDepth",
type: "number",
// TODO: GH#27108 affectsModuleResolution: true,
category: Diagnostics.Advanced_Options,
description: Diagnostics.The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files
},
@ -759,6 +784,18 @@ namespace ts {
}
];
/* @internal */
export const semanticDiagnosticsOptionDeclarations: ReadonlyArray<CommandLineOption> =
optionDeclarations.filter(option => !!option.affectsSemanticDiagnostics);
/* @internal */
export const moduleResolutionOptionDeclarations: ReadonlyArray<CommandLineOption> =
optionDeclarations.filter(option => !!option.affectsModuleResolution);
/* @internal */
export const sourceFileAffectingCompilerOptions: ReadonlyArray<CommandLineOption> = optionDeclarations.filter(option =>
!!option.affectsSourceFile || !!option.affectsModuleResolution || !!option.affectsBindDiagnostics);
/* @internal */
export const buildOpts: CommandLineOption[] = [
...commonOptionsWithBuild,
@ -1993,7 +2030,7 @@ namespace ts {
if (ownConfig.extendedConfigPath) {
// copy the resolution stack so it is never reused between branches in potential diamond-problem scenarios.
resolutionStack = resolutionStack.concat([resolvedPath]);
const extendedConfig = getExtendedConfig(sourceFile!, ownConfig.extendedConfigPath, host, basePath, resolutionStack, errors);
const extendedConfig = getExtendedConfig(sourceFile, ownConfig.extendedConfigPath, host, basePath, resolutionStack, errors);
if (extendedConfig && isSuccessfulParsedTsconfig(extendedConfig)) {
const baseRaw = extendedConfig.raw;
const raw = ownConfig.raw;
@ -2134,7 +2171,7 @@ namespace ts {
}
function getExtendedConfig(
sourceFile: TsConfigSourceFile,
sourceFile: TsConfigSourceFile | undefined,
extendedConfigPath: string,
host: ParseConfigHost,
basePath: string,
@ -2143,7 +2180,7 @@ namespace ts {
): ParsedTsconfig | undefined {
const extendedResult = readJsonConfigFile(extendedConfigPath, path => host.readFile(path));
if (sourceFile) {
(sourceFile.extendedSourceFiles || (sourceFile.extendedSourceFiles = [])).push(extendedResult.fileName);
sourceFile.extendedSourceFiles = [extendedResult.fileName];
}
if (extendedResult.parseDiagnostics.length) {
errors.push(...extendedResult.parseDiagnostics);
@ -2153,8 +2190,8 @@ namespace ts {
const extendedDirname = getDirectoryPath(extendedConfigPath);
const extendedConfig = parseConfig(/*json*/ undefined, extendedResult, host, extendedDirname,
getBaseFileName(extendedConfigPath), resolutionStack, errors);
if (sourceFile) {
sourceFile.extendedSourceFiles!.push(...extendedResult.extendedSourceFiles!);
if (sourceFile && extendedResult.extendedSourceFiles) {
sourceFile.extendedSourceFiles!.push(...extendedResult.extendedSourceFiles);
}
if (isSuccessfulParsedTsconfig(extendedConfig)) {

View File

@ -842,7 +842,7 @@ namespace ts {
return deduplicateSorted(sort(array, comparer), equalityComparer || comparer);
}
export function arrayIsEqualTo<T>(array1: ReadonlyArray<T> | undefined, array2: ReadonlyArray<T> | undefined, equalityComparer: (a: T, b: T) => boolean = equateValues): boolean {
export function arrayIsEqualTo<T>(array1: ReadonlyArray<T> | undefined, array2: ReadonlyArray<T> | undefined, equalityComparer: (a: T, b: T, index: number) => boolean = equateValues): boolean {
if (!array1 || !array2) {
return array1 === array2;
}
@ -852,7 +852,7 @@ namespace ts {
}
for (let i = 0; i < array1.length; i++) {
if (!equalityComparer(array1[i], array2[i])) {
if (!equalityComparer(array1[i], array2[i], i)) {
return false;
}
}

View File

@ -2112,6 +2112,10 @@
"category": "Error",
"code": 2585
},
"Enum type '{0}' circularly references itself.": {
"category": "Error",
"code": 2586
},
"JSX element attributes type '{0}' may not be a union type.": {
"category": "Error",
"code": 2600
@ -4145,6 +4149,10 @@
"category": "Error",
"code": 8030
},
"You cannot rename a module via a global import.": {
"category": "Error",
"code": 8031
},
"Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clause.": {
"category": "Error",
"code": 9002

View File

@ -1041,7 +1041,7 @@ namespace ts {
// SyntaxKind.TemplateMiddle
// SyntaxKind.TemplateTail
function emitLiteral(node: LiteralLikeNode) {
const text = getLiteralTextOfNode(node);
const text = getLiteralTextOfNode(node, printerOptions.neverAsciiEscape);
if ((printerOptions.sourceMap || printerOptions.inlineSourceMap)
&& (node.kind === SyntaxKind.StringLiteral || isTemplateLiteralKind(node.kind))) {
writeLiteral(text);
@ -1532,7 +1532,7 @@ namespace ts {
expression = skipPartiallyEmittedExpressions(expression);
if (isNumericLiteral(expression)) {
// check if numeric literal is a decimal literal that was originally written with a dot
const text = getLiteralTextOfNode(<LiteralExpression>expression);
const text = getLiteralTextOfNode(<LiteralExpression>expression, /*neverAsciiEscape*/ true);
return !expression.numericLiteralFlags
&& !stringContains(text, tokenToString(SyntaxKind.DotToken)!);
}
@ -3306,20 +3306,20 @@ namespace ts {
return getSourceTextOfNodeFromSourceFile(currentSourceFile, node, includeTrivia);
}
function getLiteralTextOfNode(node: LiteralLikeNode): string {
function getLiteralTextOfNode(node: LiteralLikeNode, neverAsciiEscape: boolean | undefined): string {
if (node.kind === SyntaxKind.StringLiteral && (<StringLiteral>node).textSourceNode) {
const textSourceNode = (<StringLiteral>node).textSourceNode!;
if (isIdentifier(textSourceNode)) {
return getEmitFlags(node) & EmitFlags.NoAsciiEscaping ?
return neverAsciiEscape || (getEmitFlags(node) & EmitFlags.NoAsciiEscaping) ?
`"${escapeString(getTextOfNode(textSourceNode))}"` :
`"${escapeNonAsciiString(getTextOfNode(textSourceNode))}"`;
}
else {
return getLiteralTextOfNode(textSourceNode);
return getLiteralTextOfNode(textSourceNode, neverAsciiEscape);
}
}
return getLiteralText(node, currentSourceFile);
return getLiteralText(node, currentSourceFile, neverAsciiEscape);
}
/**

View File

@ -455,7 +455,7 @@ namespace ts {
}
// If project references dont match
if (!arrayIsEqualTo(program.getProjectReferences(), projectReferences)) {
if (!arrayIsEqualTo(program.getProjectReferences(), projectReferences, projectReferenceUptoDate)) {
return false;
}
@ -483,9 +483,27 @@ namespace ts {
return true;
function sourceFileNotUptoDate(sourceFile: SourceFile): boolean {
return sourceFile.version !== getSourceVersion(sourceFile.path) ||
hasInvalidatedResolution(sourceFile.path);
function sourceFileNotUptoDate(sourceFile: SourceFile) {
return !sourceFileVersionUptoDate(sourceFile) ||
hasInvalidatedResolution(sourceFile.resolvedPath || sourceFile.path);
}
function sourceFileVersionUptoDate(sourceFile: SourceFile) {
return sourceFile.version === getSourceVersion(sourceFile.resolvedPath || sourceFile.path);
}
function projectReferenceUptoDate(oldRef: ProjectReference, newRef: ProjectReference, index: number) {
if (!projectReferenceIsEqualTo(oldRef, newRef)) {
return false;
}
const oldResolvedRef = program!.getResolvedProjectReferences()![index];
if (oldResolvedRef) {
// If sourceFile for the oldResolvedRef existed, check the version for uptodate
return sourceFileVersionUptoDate(oldResolvedRef.sourceFile);
}
// In old program, not able to resolve project reference path,
// so if config file doesnt exist, it is uptodate.
return !fileExists(resolveProjectReferencePath(oldRef));
}
}
@ -496,23 +514,15 @@ namespace ts {
}
/**
* Determined if source file needs to be re-created even if its text hasn't changed
* Determine if source file needs to be re-created even if its text hasn't changed
*/
function shouldProgramCreateNewSourceFiles(program: Program | undefined, newOptions: CompilerOptions) {
// If any of these options change, we can't reuse old source file even if version match
// The change in options like these could result in change in syntax tree change
const oldOptions = program && program.getCompilerOptions();
return oldOptions && (
oldOptions.target !== newOptions.target ||
oldOptions.module !== newOptions.module ||
oldOptions.moduleResolution !== newOptions.moduleResolution ||
oldOptions.noResolve !== newOptions.noResolve ||
oldOptions.jsx !== newOptions.jsx ||
oldOptions.allowJs !== newOptions.allowJs ||
oldOptions.disableSizeLimit !== newOptions.disableSizeLimit ||
oldOptions.baseUrl !== newOptions.baseUrl ||
!equalOwnProperties(oldOptions.paths, newOptions.paths)
);
function shouldProgramCreateNewSourceFiles(program: Program | undefined, newOptions: CompilerOptions): boolean {
if (!program) return false;
// If any compiler options change, we can't reuse old source file even if version match
// The change in options like these could result in change in syntax tree or `sourceFile.bindDiagnostics`.
const oldOptions = program.getCompilerOptions();
return !!sourceFileAffectingCompilerOptions.some(option =>
!isJsonEqual(getCompilerOptionValue(oldOptions, option), getCompilerOptionValue(newOptions, option)));
}
function createCreateProgramOptions(rootNames: ReadonlyArray<string>, options: CompilerOptions, host?: CompilerHost, oldProgram?: Program, configFileParsingDiagnostics?: ReadonlyArray<Diagnostic>): CreateProgramOptions {
@ -666,8 +676,9 @@ namespace ts {
const parsedRef = parseProjectReferenceConfigFile(ref);
resolvedProjectReferences!.push(parsedRef);
if (parsedRef) {
if (parsedRef.commandLine.options.outFile) {
const dtsOutfile = changeExtension(parsedRef.commandLine.options.outFile, ".d.ts");
const out = parsedRef.commandLine.options.outFile || parsedRef.commandLine.options.out;
if (out) {
const dtsOutfile = changeExtension(out, ".d.ts");
processSourceFile(dtsOutfile, /*isDefaultLib*/ false, /*ignoreNoDefaultLib*/ false, /*packageId*/ undefined);
}
addProjectReferenceRedirects(parsedRef.commandLine, projectReferenceRedirects);
@ -766,7 +777,8 @@ namespace ts {
getConfigFileParsingDiagnostics,
getResolvedModuleWithFailedLookupLocationsFromCache,
getProjectReferences,
getResolvedProjectReferences
getResolvedProjectReferences,
getProjectReferenceRedirect
};
verifyCompilerOptions();
@ -1233,6 +1245,13 @@ namespace ts {
}
resolvedTypeReferenceDirectives = oldProgram.getResolvedTypeReferenceDirectives();
resolvedProjectReferences = oldProgram.getResolvedProjectReferences();
if (resolvedProjectReferences) {
resolvedProjectReferences.forEach(ref => {
if (ref) {
addProjectReferenceRedirects(ref.commandLine, projectReferenceRedirects);
}
});
}
sourceFileToPackageName = oldProgram.sourceFileToPackageName;
redirectTargetsMap = oldProgram.redirectTargetsMap;
@ -1288,12 +1307,13 @@ namespace ts {
const ref = projectReferences[i];
const resolvedRefOpts = resolvedProjectReferences![i]!.commandLine;
if (ref.prepend && resolvedRefOpts && resolvedRefOpts.options) {
const out = resolvedRefOpts.options.outFile || resolvedRefOpts.options.out;
// Upstream project didn't have outFile set -- skip (error will have been issued earlier)
if (!resolvedRefOpts.options.outFile) continue;
if (!out) continue;
const dtsFilename = changeExtension(resolvedRefOpts.options.outFile, ".d.ts");
const js = host.readFile(resolvedRefOpts.options.outFile) || `/* Input file ${resolvedRefOpts.options.outFile} was missing */\r\n`;
const jsMapPath = resolvedRefOpts.options.outFile + ".map"; // TODO: try to read sourceMappingUrl comment from the file
const dtsFilename = changeExtension(out, ".d.ts");
const js = host.readFile(out) || `/* Input file ${out} was missing */\r\n`;
const jsMapPath = out + ".map"; // TODO: try to read sourceMappingUrl comment from the file
const jsMap = host.readFile(jsMapPath);
const dts = host.readFile(dtsFilename) || `/* Input file ${dtsFilename} was missing */\r\n`;
const dtsMapPath = dtsFilename + ".map";
@ -2435,9 +2455,10 @@ namespace ts {
createDiagnosticForReference(i, Diagnostics.Referenced_project_0_must_have_setting_composite_Colon_true, ref.path);
}
if (ref.prepend) {
if (resolvedRefOpts.outFile) {
if (!host.fileExists(resolvedRefOpts.outFile)) {
createDiagnosticForReference(i, Diagnostics.Output_file_0_from_project_1_does_not_exist, resolvedRefOpts.outFile, ref.path);
const out = resolvedRefOpts.outFile || resolvedRefOpts.out;
if (out) {
if (!host.fileExists(out)) {
createDiagnosticForReference(i, Diagnostics.Output_file_0_from_project_1_does_not_exist, out, ref.path);
}
}
else {
@ -2829,7 +2850,10 @@ namespace ts {
export function parseConfigHostFromCompilerHost(host: CompilerHost): ParseConfigFileHost {
return {
fileExists: f => host.fileExists(f),
readDirectory: (root, extensions, includes, depth?) => host.readDirectory ? host.readDirectory(root, extensions, includes, depth) : [],
readDirectory(root, extensions, excludes, includes, depth) {
Debug.assertDefined(host.readDirectory, "'CompilerHost.readDirectory' must be implemented to correctly process 'projectReferences'");
return host.readDirectory!(root, extensions, excludes, includes, depth);
},
readFile: f => host.readFile(f),
useCaseSensitiveFileNames: host.useCaseSensitiveFileNames(),
getCurrentDirectory: () => host.getCurrentDirectory(),

View File

@ -285,16 +285,17 @@ namespace ts {
}
function getOutFileOutputs(project: ParsedCommandLine): ReadonlyArray<string> {
if (!project.options.outFile) {
const out = project.options.outFile || project.options.out;
if (!out) {
return Debug.fail("outFile must be set");
}
const outputs: string[] = [];
outputs.push(project.options.outFile);
outputs.push(out);
if (project.options.sourceMap) {
outputs.push(`${project.options.outFile}.map`);
outputs.push(`${out}.map`);
}
if (getEmitDeclarations(project.options)) {
const dts = changeExtension(project.options.outFile, Extension.Dts);
const dts = changeExtension(out, Extension.Dts);
outputs.push(dts);
if (project.options.declarationMap) {
outputs.push(`${dts}.map`);
@ -862,7 +863,7 @@ namespace ts {
if (buildProject) {
buildSingleInvalidatedProject(buildProject.project, buildProject.reloadLevel);
if (hasPendingInvalidatedProjects()) {
if (!timerToBuildInvalidatedProject) {
if (options.watch && !timerToBuildInvalidatedProject) {
scheduleBuildInvalidatedProject();
}
}
@ -1248,7 +1249,7 @@ namespace ts {
}
export function getAllProjectOutputs(project: ParsedCommandLine): ReadonlyArray<string> {
if (project.options.outFile) {
if (project.options.outFile || project.options.out) {
return getOutFileOutputs(project);
}
else {

View File

@ -2551,6 +2551,11 @@ namespace ts {
fileName: string;
/* @internal */ path: Path;
text: string;
/** Resolved path can be different from path property,
* when file is included through project reference is mapped to its output instead of source
* in that case resolvedPath = path to output file
* path = input file's path
*/
/* @internal */ resolvedPath: Path;
/**
@ -2819,6 +2824,7 @@ namespace ts {
getProjectReferences(): ReadonlyArray<ProjectReference> | undefined;
getResolvedProjectReferences(): (ResolvedProjectReference | undefined)[] | undefined;
/*@internal*/ getProjectReferenceRedirect(fileName: string): string | undefined;
}
/* @internal */
@ -3670,6 +3676,7 @@ namespace ts {
export interface NodeLinks {
flags: NodeCheckFlags; // Set of flags specific to Node
resolvedType?: Type; // Cached type of type node
resolvedEnumType?: Type; // Cached constraint type from enum jsdoc tag
resolvedSignature?: Signature; // Cached signature of signature node or call expression
resolvedSignatures?: Map<Signature[]>; // Cached signatures of jsx node
resolvedSymbol?: Symbol; // Cached name resolution result
@ -4569,6 +4576,9 @@ namespace ts {
showInSimplifiedHelpView?: boolean;
category?: DiagnosticMessage;
strictFlag?: true; // true if the option is one of the flag under strict
affectsSourceFile?: true; // true if we should recreate SourceFiles after this option changes
affectsModuleResolution?: true; // currently same effect as `affectsSourceFile`
affectsBindDiagnostics?: true; // true if this affects binding (currently same effect as `affectsSourceFile`)
affectsSemanticDiagnostics?: true; // true if option affects semantic diagnostics
}
@ -4964,7 +4974,7 @@ namespace ts {
/* @internal */
export interface EmitNode {
annotatedNodes?: Node[]; // Tracks Parse-tree nodes with EmitNodes for eventual cleanup.
flags: EmitFlags; // Flags that customize emit
flags: EmitFlags; // Flags that customize emit
leadingComments?: SynthesizedComment[]; // Synthesized leading comments
trailingComments?: SynthesizedComment[]; // Synthesized trailing comments
commentRange?: TextRange; // The text range to use when emitting leading or trailing comments
@ -5324,6 +5334,7 @@ namespace ts {
/*@internal*/ inlineSourceMap?: boolean;
/*@internal*/ extendedDiagnostics?: boolean;
/*@internal*/ onlyPrintJsDocStyle?: boolean;
/*@internal*/ neverAsciiEscape?: boolean;
}
/* @internal */

View File

@ -101,22 +101,8 @@ namespace ts {
}
export function changesAffectModuleResolution(oldOptions: CompilerOptions, newOptions: CompilerOptions): boolean {
return !oldOptions ||
(oldOptions.module !== newOptions.module) ||
(oldOptions.moduleResolution !== newOptions.moduleResolution) ||
(oldOptions.noResolve !== newOptions.noResolve) ||
(oldOptions.target !== newOptions.target) ||
(oldOptions.noLib !== newOptions.noLib) ||
(oldOptions.jsx !== newOptions.jsx) ||
(oldOptions.allowJs !== newOptions.allowJs) ||
(oldOptions.rootDir !== newOptions.rootDir) ||
(oldOptions.configFilePath !== newOptions.configFilePath) ||
(oldOptions.baseUrl !== newOptions.baseUrl) ||
(oldOptions.maxNodeModuleJsDepth !== newOptions.maxNodeModuleJsDepth) ||
!arrayIsEqualTo(oldOptions.lib, newOptions.lib) ||
!arrayIsEqualTo(oldOptions.typeRoots, newOptions.typeRoots) ||
!arrayIsEqualTo(oldOptions.rootDirs, newOptions.rootDirs) ||
!equalOwnProperties(oldOptions.paths, newOptions.paths);
return oldOptions.configFilePath !== newOptions.configFilePath || moduleResolutionOptionDeclarations.some(o =>
!isJsonEqual(getCompilerOptionValue(oldOptions, o), getCompilerOptionValue(newOptions, o)));
}
/**
@ -538,14 +524,14 @@ namespace ts {
return emitNode && emitNode.flags || 0;
}
export function getLiteralText(node: LiteralLikeNode, sourceFile: SourceFile) {
export function getLiteralText(node: LiteralLikeNode, sourceFile: SourceFile, neverAsciiEscape: boolean | undefined) {
// If we don't need to downlevel and we can reach the original source text using
// the node's parent reference, then simply get the text as it was originally written.
if (!nodeIsSynthesized(node) && node.parent && !(isNumericLiteral(node) && node.numericLiteralFlags & TokenFlags.ContainsSeparator)) {
return getSourceTextOfNodeFromSourceFile(sourceFile, node);
}
const escapeText = getEmitFlags(node) & EmitFlags.NoAsciiEscaping ? escapeString : escapeNonAsciiString;
const escapeText = neverAsciiEscape || (getEmitFlags(node) & EmitFlags.NoAsciiEscaping) ? escapeString : escapeNonAsciiString;
// If we can't reach the original source text, use the canonical form if it's a number,
// or a (possibly escaped) quoted form of the original text if it's string-like.
@ -7091,9 +7077,8 @@ namespace ts {
const moduleKind = getEmitModuleKind(compilerOptions);
return compilerOptions.allowSyntheticDefaultImports !== undefined
? compilerOptions.allowSyntheticDefaultImports
: compilerOptions.esModuleInterop
? moduleKind !== ModuleKind.None && moduleKind < ModuleKind.ES2015
: moduleKind === ModuleKind.System;
: compilerOptions.esModuleInterop ||
moduleKind === ModuleKind.System;
}
export function getEmitDeclarations(compilerOptions: CompilerOptions): boolean {
@ -7106,13 +7091,13 @@ namespace ts {
return compilerOptions[flag] === undefined ? !!compilerOptions.strict : !!compilerOptions[flag];
}
export function compilerOptionsAffectSemanticDiagnostics(newOptions: CompilerOptions, oldOptions: CompilerOptions) {
if (oldOptions === newOptions) {
return false;
}
export function compilerOptionsAffectSemanticDiagnostics(newOptions: CompilerOptions, oldOptions: CompilerOptions): boolean {
return oldOptions !== newOptions &&
semanticDiagnosticsOptionDeclarations.some(option => !isJsonEqual(getCompilerOptionValue(oldOptions, option), getCompilerOptionValue(newOptions, option)));
}
return optionDeclarations.some(option => (!!option.strictFlag && getStrictOptionValue(newOptions, option.name as StrictOptionName) !== getStrictOptionValue(oldOptions, option.name as StrictOptionName)) ||
(!!option.affectsSemanticDiagnostics && !newOptions[option.name] !== !oldOptions[option.name]));
export function getCompilerOptionValue(options: CompilerOptions, option: CommandLineOption): unknown {
return option.strictFlag ? getStrictOptionValue(options, option.name as StrictOptionName) : options[option.name];
}
export function hasZeroOrOneAsteriskCharacter(str: string): boolean {
@ -8380,4 +8365,8 @@ namespace ts {
// '/// <reference no-default-lib="true"/>' directive.
return options.skipLibCheck && sourceFile.isDeclarationFile || options.skipDefaultLibCheck && sourceFile.hasNoDefaultLib;
}
export function isJsonEqual(a: unknown, b: unknown): boolean {
return a === b || typeof a === "object" && a !== null && typeof b === "object" && b !== null && equalOwnProperties(a as MapLike<unknown>, b as MapLike<unknown>, isJsonEqual);
}
}

View File

@ -187,9 +187,10 @@ interface Array<T> {}`
}
export function checkArray(caption: string, actual: ReadonlyArray<string>, expected: ReadonlyArray<string>) {
checkMapKeys(caption, arrayToMap(actual, identity), expected);
assert.equal(actual.length, expected.length, `${caption}: incorrect actual number of files, expected:\r\n${expected.join("\r\n")}\r\ngot: ${actual.join("\r\n")}`);
for (const f of expected) {
assert.equal(true, contains(actual, f), `${caption}: expected to find ${f} in ${actual}`);
assert.isTrue(contains(actual, f), `${caption}: expected to find ${f} in ${actual}`);
}
}
@ -654,7 +655,7 @@ interface Array<T> {}`
invokeWatcherCallbacks(this.watchedDirectoriesRecursive.get(this.toPath(folderFullPath))!, cb => this.directoryCallback(cb, relativePath));
}
invokeFileWatcher(fileFullPath: string, eventKind: FileWatcherEventKind, useFileNameInCallback?: boolean) {
private invokeFileWatcher(fileFullPath: string, eventKind: FileWatcherEventKind, useFileNameInCallback?: boolean) {
invokeWatcherCallbacks(this.watchedFiles.get(this.toPath(fileFullPath))!, ({ cb, fileName }) => cb(useFileNameInCallback ? fileName : fileFullPath, eventKind));
}
@ -934,7 +935,12 @@ interface Array<T> {}`
const folder = this.fs.get(base) as FsFolder;
Debug.assert(isFsFolder(folder));
this.addFileOrFolderInFolder(folder, file);
if (!this.fs.has(file.path)) {
this.addFileOrFolderInFolder(folder, file);
}
else {
this.modifyFile(path, content);
}
}
write(message: string) {

View File

@ -1123,6 +1123,9 @@ namespace ts.server.protocol {
* Optional modifiers for the kind (such as 'public').
*/
kindModifiers: string;
/** Span of text to rename. */
triggerSpan: TextSpan;
}
/**

View File

@ -336,16 +336,23 @@ namespace ts.server {
function combineProjectOutputForReferences(projects: Projects, defaultProject: Project, initialLocation: sourcemaps.SourceMappableLocation, projectService: ProjectService): ReadonlyArray<ReferencedSymbol> {
const outputs: ReferencedSymbol[] = [];
combineProjectOutputWorker<sourcemaps.SourceMappableLocation>(projects, defaultProject, initialLocation, projectService, ({ project, location }, tryAddToTodo) => {
combineProjectOutputWorker<sourcemaps.SourceMappableLocation>(projects, defaultProject, initialLocation, projectService, ({ project, location }, getMappedLocation) => {
for (const outputReferencedSymbol of project.getLanguageService().findReferences(location.fileName, location.position) || emptyArray) {
let symbolToAddTo = find(outputs, o => documentSpansEqual(o.definition, outputReferencedSymbol.definition));
const mappedDefinitionFile = getMappedLocation(project, documentSpanLocation(outputReferencedSymbol.definition));
const definition: ReferencedSymbolDefinitionInfo = mappedDefinitionFile === undefined ? outputReferencedSymbol.definition : {
...outputReferencedSymbol.definition,
textSpan: createTextSpan(mappedDefinitionFile.position, outputReferencedSymbol.definition.textSpan.length),
fileName: mappedDefinitionFile.fileName,
};
let symbolToAddTo = find(outputs, o => documentSpansEqual(o.definition, definition));
if (!symbolToAddTo) {
symbolToAddTo = { definition: outputReferencedSymbol.definition, references: [] };
symbolToAddTo = { definition, references: [] };
outputs.push(symbolToAddTo);
}
for (const ref of outputReferencedSymbol.references) {
if (!contains(symbolToAddTo.references, ref, documentSpansEqual) && !tryAddToTodo(project, documentSpanLocation(ref))) {
// If it's in a mapped file, that is added to the todo list by `getMappedLocation`.
if (!contains(symbolToAddTo.references, ref, documentSpansEqual) && !getMappedLocation(project, documentSpanLocation(ref))) {
symbolToAddTo.references.push(ref);
}
}
@ -373,12 +380,17 @@ namespace ts.server {
}
}
type CombineProjectOutputCallback<TLocation extends sourcemaps.SourceMappableLocation | undefined> = (
where: ProjectAndLocation<TLocation>,
getMappedLocation: (project: Project, location: sourcemaps.SourceMappableLocation) => sourcemaps.SourceMappableLocation | undefined,
) => void;
function combineProjectOutputWorker<TLocation extends sourcemaps.SourceMappableLocation | undefined>(
projects: Projects,
defaultProject: Project,
initialLocation: TLocation,
projectService: ProjectService,
cb: (where: ProjectAndLocation<TLocation>, getMappedLocation: (project: Project, location: sourcemaps.SourceMappableLocation) => boolean) => void,
cb: CombineProjectOutputCallback<TLocation>,
getDefinition: (() => sourcemaps.SourceMappableLocation | undefined) | undefined,
): void {
let toDo: ProjectAndLocation<TLocation>[] | undefined;
@ -417,13 +429,13 @@ namespace ts.server {
projectService: ProjectService,
toDo: ProjectAndLocation<TLocation>[] | undefined,
seenProjects: Map<true>,
cb: (where: ProjectAndLocation<TLocation>, getMappedLocation: (project: Project, location: sourcemaps.SourceMappableLocation) => boolean) => void,
cb: CombineProjectOutputCallback<TLocation>,
): ProjectAndLocation<TLocation>[] | undefined {
if (projectAndLocation.project.getCancellationToken().isCancellationRequested()) return undefined; // Skip rest of toDo if cancelled
cb(projectAndLocation, (project, location) => {
seenProjects.set(projectAndLocation.project.projectName, true);
const originalLocation = projectService.getOriginalLocationEnsuringConfiguredProject(project, location);
if (!originalLocation) return false;
if (!originalLocation) return undefined;
const originalScriptInfo = projectService.getScriptInfo(originalLocation.fileName)!;
toDo = toDo || [];
@ -437,7 +449,7 @@ namespace ts.server {
for (const symlinkedProject of symlinkedProjects) addToTodo({ project: symlinkedProject, location: originalLocation as TLocation }, toDo!, seenProjects);
});
}
return true;
return originalLocation;
});
return toDo;
}
@ -1149,13 +1161,12 @@ namespace ts.server {
if (!simplifiedResult) return locations;
const defaultProject = this.getDefaultProject(args);
const renameInfo = Session.mapRenameInfo(defaultProject.getLanguageService().getRenameInfo(file, position));
const renameInfo: protocol.RenameInfo = this.mapRenameInfo(defaultProject.getLanguageService().getRenameInfo(file, position), Debug.assertDefined(this.projectService.getScriptInfo(file)));
return { info: renameInfo, locs: this.toSpanGroups(locations) };
}
// strips 'triggerSpan'
private static mapRenameInfo({ canRename, localizedErrorMessage, displayName, fullDisplayName, kind, kindModifiers }: RenameInfo): protocol.RenameInfo {
return { canRename, localizedErrorMessage, displayName, fullDisplayName, kind, kindModifiers };
private mapRenameInfo({ canRename, localizedErrorMessage, displayName, fullDisplayName, kind, kindModifiers, triggerSpan }: RenameInfo, scriptInfo: ScriptInfo): protocol.RenameInfo {
return { canRename, localizedErrorMessage, displayName, fullDisplayName, kind, kindModifiers, triggerSpan: this.toLocationTextSpan(triggerSpan, scriptInfo) };
}
private toSpanGroups(locations: ReadonlyArray<RenameLocation>): ReadonlyArray<protocol.SpanGroup> {

View File

@ -397,7 +397,7 @@ namespace ts.codefix {
}
// should be kept up to date with isFixablePromiseArgument in suggestionDiagnostics.ts
function getTransformationBody(func: Node, prevArgName: SynthIdentifier | undefined, argName: SynthIdentifier | undefined, parent: CallExpression, transformer: Transformer): NodeArray<Statement> {
function getTransformationBody(func: Expression, prevArgName: SynthIdentifier | undefined, argName: SynthIdentifier | undefined, parent: CallExpression, transformer: Transformer): NodeArray<Statement> {
const shouldReturn = transformer.setOfExpressionsToReturn.get(getNodeId(parent).toString());
switch (func.kind) {
@ -427,13 +427,14 @@ namespace ts.codefix {
return varDeclOrAssignment;
case SyntaxKind.FunctionExpression:
case SyntaxKind.ArrowFunction:
case SyntaxKind.ArrowFunction: {
const funcBody = (func as FunctionExpression | ArrowFunction).body;
// Arrow functions with block bodies { } will enter this control flow
if (isFunctionLikeDeclaration(func) && func.body && isBlock(func.body) && func.body.statements) {
if (isBlock(funcBody)) {
let refactoredStmts: Statement[] = [];
let seenReturnStatement = false;
for (const statement of func.body.statements) {
for (const statement of funcBody.statements) {
if (isReturnStatement(statement)) {
seenReturnStatement = true;
}
@ -450,7 +451,6 @@ namespace ts.codefix {
removeReturns(createNodeArray(refactoredStmts), prevArgName!.identifier, transformer, seenReturnStatement);
}
else {
const funcBody = cast((<ArrowFunction>func).body, isExpression);
const innerRetStmts = getReturnStatementsWithPromiseHandlers(createReturn(funcBody));
const innerCbBody = getInnerTransformationBody(transformer, innerRetStmts, prevArgName);
@ -473,6 +473,7 @@ namespace ts.codefix {
return createNodeArray([createReturn(getSynthesizedDeepClone(funcBody))]);
}
}
}
default:
// If no cases apply, we've found a transformation body we don't know how to handle, so the refactoring should no-op to avoid deleting code.
codeActionSucceeded = false;

View File

@ -121,10 +121,6 @@ namespace ts {
const buckets = createMap<Map<DocumentRegistryEntry>>();
const getCanonicalFileName = createGetCanonicalFileName(!!useCaseSensitiveFileNames);
function getKeyForCompilationSettings(settings: CompilerOptions): DocumentRegistryBucketKey {
return <DocumentRegistryBucketKey>`_${settings.target}|${settings.module}|${settings.noResolve}|${settings.jsx}|${settings.allowJs}|${settings.baseUrl}|${JSON.stringify(settings.typeRoots)}|${JSON.stringify(settings.rootDirs)}|${JSON.stringify(settings.paths)}`;
}
function getBucketForCompilationSettings(key: DocumentRegistryBucketKey, createIfMissing: boolean): Map<DocumentRegistryEntry> {
let bucket = buckets.get(key);
if (!bucket && createIfMissing) {
@ -273,4 +269,8 @@ namespace ts {
getKeyForCompilationSettings
};
}
function getKeyForCompilationSettings(settings: CompilerOptions): DocumentRegistryBucketKey {
return sourceFileAffectingCompilerOptions.map(option => getCompilerOptionValue(settings, option)).join("|") as DocumentRegistryBucketKey;
}
}

View File

@ -39,11 +39,18 @@ namespace ts.Rename {
}
function getRenameInfoForModule(node: StringLiteralLike, sourceFile: SourceFile, moduleSymbol: Symbol): RenameInfo | undefined {
if (!isExternalModuleNameRelative(node.text)) {
return getRenameInfoError(Diagnostics.You_cannot_rename_a_module_via_a_global_import);
}
const moduleSourceFile = find(moduleSymbol.declarations, isSourceFile);
if (!moduleSourceFile) return undefined;
const withoutIndex = node.text.endsWith("/index") || node.text.endsWith("/index.js") ? undefined : tryRemoveSuffix(removeFileExtension(moduleSourceFile.fileName), "/index");
const name = withoutIndex === undefined ? moduleSourceFile.fileName : withoutIndex;
const kind = withoutIndex === undefined ? ScriptElementKind.moduleElement : ScriptElementKind.directory;
const indexAfterLastSlash = node.text.lastIndexOf("/") + 1;
// Span should only be the last component of the path. + 1 to account for the quote character.
const triggerSpan = createTextSpan(node.getStart(sourceFile) + 1 + indexAfterLastSlash, node.text.length - indexAfterLastSlash);
return {
canRename: true,
fileToRename: name,
@ -52,7 +59,7 @@ namespace ts.Rename {
localizedErrorMessage: undefined,
fullDisplayName: name,
kindModifiers: ScriptElementKindModifier.none,
triggerSpan: createTriggerSpanForNode(node, sourceFile),
triggerSpan,
};
}

View File

@ -1218,6 +1218,10 @@ namespace ts {
getDirectories: path => {
return host.getDirectories ? host.getDirectories(path) : [];
},
readDirectory(path, extensions, exclude, include, depth) {
Debug.assertDefined(host.readDirectory, "'LanguageServiceHost.readDirectory' must be implemented to correctly process 'projectReferences'");
return host.readDirectory!(path, extensions, exclude, include, depth);
},
onReleaseOldSourceFile,
hasInvalidatedResolution,
hasChangedAutomaticTypeDirectiveNames: host.hasChangedAutomaticTypeDirectiveNames

View File

@ -781,7 +781,7 @@ namespace ts.textChanges {
function getNonformattedText(node: Node, sourceFile: SourceFile | undefined, newLineCharacter: string): { text: string, node: Node } {
const writer = new Writer(newLineCharacter);
const newLine = newLineCharacter === "\n" ? NewLineKind.LineFeed : NewLineKind.CarriageReturnLineFeed;
createPrinter({ newLine }, writer).writeNode(EmitHint.Unspecified, node, sourceFile, writer);
createPrinter({ newLine, neverAsciiEscape: true }, writer).writeNode(EmitHint.Unspecified, node, sourceFile, writer);
return { text: writer.getText(), node: assignPositionsToNode(node) };
}
}

View File

@ -244,6 +244,20 @@ namespace ts {
}, [
combinePaths(basePath, "main.ts")
]);
it("adds extendedSourceFiles only once", () => {
const sourceFile = readJsonConfigFile("configs/fourth.json", (path) => host.readFile(path));
const dir = combinePaths(basePath, "configs");
const expected = [
combinePaths(dir, "third.json"),
combinePaths(dir, "second.json"),
combinePaths(dir, "base.json"),
];
parseJsonSourceFileConfigFileContent(sourceFile, host, dir, {}, "fourth.json");
assert.deepEqual(sourceFile.extendedSourceFiles, expected);
parseJsonSourceFileConfigFileContent(sourceFile, host, dir, {}, "fourth.json");
assert.deepEqual(sourceFile.extendedSourceFiles, expected);
});
});
});
});

View File

@ -305,10 +305,10 @@ namespace ts {
assert.equal(program1.structureIsReused, StructureIsReused.Not);
});
it("fails if rootdir changes", () => {
it("succeeds if rootdir changes", () => {
const program1 = newProgram(files, ["a.ts"], { target, module: ModuleKind.CommonJS, rootDir: "/a/b" });
updateProgram(program1, ["a.ts"], { target, module: ModuleKind.CommonJS, rootDir: "/a/c" }, noop);
assert.equal(program1.structureIsReused, StructureIsReused.Not);
assert.equal(program1.structureIsReused, StructureIsReused.Completely);
});
it("fails if config path changes", () => {

View File

@ -34,6 +34,10 @@ namespace ts.tscWatch {
return `${projectPath(subProject)}/${baseFileName.toLowerCase()}`;
}
function projectFileName(subProject: SubProject, baseFileName: string) {
return `${projectPath(subProject)}/${baseFileName}`;
}
function projectFile(subProject: SubProject, baseFileName: string): File {
return {
path: projectFilePath(subProject, baseFileName),
@ -94,6 +98,7 @@ namespace ts.tscWatch {
const ui = subProjectFiles(SubProject.ui);
const allFiles: ReadonlyArray<File> = [libFile, ...core, ...logic, ...tests, ...ui];
const testProjectExpectedWatchedFiles = [core[0], core[1], core[2], ...logic, ...tests].map(f => f.path);
const testProjectExpectedWatchedDirectoriesRecursive = [projectPath(SubProject.core), projectPath(SubProject.logic)];
function createSolutionInWatchMode(allFiles: ReadonlyArray<File>, defaultOptions?: BuildOptions, disableConsoleClears?: boolean) {
const host = createWatchedSystem(allFiles, { currentDirectory: projectsLocation });
@ -110,7 +115,7 @@ namespace ts.tscWatch {
function verifyWatches(host: WatchedSystem) {
checkWatchedFiles(host, testProjectExpectedWatchedFiles);
checkWatchedDirectories(host, emptyArray, /*recursive*/ false);
checkWatchedDirectories(host, [projectPath(SubProject.core), projectPath(SubProject.logic)], /*recursive*/ true);
checkWatchedDirectories(host, testProjectExpectedWatchedDirectoriesRecursive, /*recursive*/ true);
}
it("creates solution in watch mode", () => {
@ -161,7 +166,7 @@ namespace ts.tscWatch {
function verifyWatches() {
checkWatchedFiles(host, additionalFiles ? testProjectExpectedWatchedFiles.concat(newFile.path) : testProjectExpectedWatchedFiles);
checkWatchedDirectories(host, emptyArray, /*recursive*/ false);
checkWatchedDirectories(host, [projectPath(SubProject.core), projectPath(SubProject.logic)], /*recursive*/ true);
checkWatchedDirectories(host, testProjectExpectedWatchedDirectoriesRecursive, /*recursive*/ true);
}
}
@ -347,7 +352,7 @@ function myFunc() { return 100; }`);
function verifyWatches() {
checkWatchedFiles(host, projectFiles.map(f => f.path));
checkWatchedDirectories(host, emptyArray, /*recursive*/ false);
checkWatchedDirectories(host, [projectPath(SubProject.core), projectPath(SubProject.logic)], /*recursive*/ true);
checkWatchedDirectories(host, testProjectExpectedWatchedDirectoriesRecursive, /*recursive*/ true);
}
});
@ -389,12 +394,106 @@ let x: string = 10;`);
});
});
it("tsc-watch works with project references", () => {
// Build the composite project
const host = createSolutionInWatchMode(allFiles);
describe("tsc-watch works with project references", () => {
const coreIndexDts = projectFileName(SubProject.core, "index.d.ts");
const coreAnotherModuleDts = projectFileName(SubProject.core, "anotherModule.d.ts");
const logicIndexDts = projectFileName(SubProject.logic, "index.d.ts");
const expectedWatchedFiles = [core[0], logic[0], ...tests, libFile].map(f => f.path).concat([coreIndexDts, coreAnotherModuleDts, logicIndexDts].map(f => f.toLowerCase()));
const expectedWatchedDirectoriesRecursive = projectSystem.getTypeRootsFromLocation(projectPath(SubProject.tests));
createWatchOfConfigFile(tests[0].path, host);
checkOutputErrorsInitial(host, emptyArray);
function createSolution() {
const host = createWatchedSystem(allFiles, { currentDirectory: projectsLocation });
const solutionBuilder = createSolutionBuilder(host, [`${project}/${SubProject.tests}`], {});
return { host, solutionBuilder };
}
function createBuiltSolution() {
const result = createSolution();
const { host, solutionBuilder } = result;
solutionBuilder.buildAllProjects();
const outputFileStamps = getOutputFileStamps(host);
for (const stamp of outputFileStamps) {
assert.isDefined(stamp[1], `${stamp[0]} expected to be present`);
}
return result;
}
function verifyWatches(host: WatchedSystem) {
checkWatchedFilesDetailed(host, expectedWatchedFiles, 1);
checkWatchedDirectories(host, emptyArray, /*recursive*/ false);
checkWatchedDirectoriesDetailed(host, expectedWatchedDirectoriesRecursive, 1, /*recursive*/ true);
}
function createSolutionAndWatchMode() {
// Build the composite project
const { host, solutionBuilder } = createBuiltSolution();
// Build in watch mode
const watch = createWatchOfConfigFileReturningBuilder(tests[0].path, host);
checkOutputErrorsInitial(host, emptyArray);
return { host, solutionBuilder, watch };
}
function verifyDependencies(watch: () => BuilderProgram, filePath: string, expected: ReadonlyArray<string>) {
checkArray(`${filePath} dependencies`, watch().getAllDependencies(watch().getSourceFile(filePath)!), expected);
}
describe("invoking when references are already built", () => {
it("verifies dependencies and watches", () => {
const { host, watch } = createSolutionAndWatchMode();
verifyWatches(host);
verifyDependencies(watch, coreIndexDts, [coreIndexDts]);
verifyDependencies(watch, coreAnotherModuleDts, [coreAnotherModuleDts]);
verifyDependencies(watch, logicIndexDts, [logicIndexDts, coreAnotherModuleDts]);
verifyDependencies(watch, tests[1].path, [tests[1].path, coreAnotherModuleDts, logicIndexDts, coreAnotherModuleDts]);
});
it("local edit in ts file, result in watch compilation because logic.d.ts is written", () => {
const { host, solutionBuilder, watch } = createSolutionAndWatchMode();
host.writeFile(logic[1].path, `${logic[1].content}
function foo() {
}`);
solutionBuilder.invalidateProject(`${project}/${SubProject.logic}`);
solutionBuilder.buildInvalidatedProject();
host.checkTimeoutQueueLengthAndRun(1); // not ideal, but currently because of d.ts but no new file is written
checkOutputErrorsIncremental(host, emptyArray);
checkProgramActualFiles(watch().getProgram(), [tests[1].path, libFile.path, coreIndexDts, coreAnotherModuleDts, logicIndexDts]);
});
it("non local edit in ts file, rebuilds in watch compilation", () => {
const { host, solutionBuilder, watch } = createSolutionAndWatchMode();
host.writeFile(logic[1].path, `${logic[1].content}
export function gfoo() {
}`);
solutionBuilder.invalidateProject(logic[0].path);
solutionBuilder.buildInvalidatedProject();
host.checkTimeoutQueueLengthAndRun(1);
checkOutputErrorsIncremental(host, emptyArray);
checkProgramActualFiles(watch().getProgram(), [tests[1].path, libFile.path, coreIndexDts, coreAnotherModuleDts, logicIndexDts]);
});
it("change in project reference config file builds correctly", () => {
const { host, solutionBuilder, watch } = createSolutionAndWatchMode();
host.writeFile(logic[0].path, JSON.stringify({
compilerOptions: { composite: true, declaration: true, declarationDir: "decls" },
references: [{ path: "../core" }]
}));
solutionBuilder.invalidateProject(logic[0].path, ConfigFileProgramReloadLevel.Full);
solutionBuilder.buildInvalidatedProject();
host.checkTimeoutQueueLengthAndRun(1);
checkOutputErrorsIncremental(host, [
// TODO: #26036
// The error is reported in d.ts file because it isnt resolved from ts file path, but is resolved from .d.ts file
"sample1/logic/decls/index.d.ts(2,22): error TS2307: Cannot find module '../core/anotherModule'.\n"
]);
checkProgramActualFiles(watch().getProgram(), [tests[1].path, libFile.path, coreIndexDts, coreAnotherModuleDts, projectFilePath(SubProject.logic, "decls/index.d.ts")]);
});
});
});
});
}

View File

@ -20,6 +20,13 @@ namespace ts.tscWatch {
checkArray(`Program rootFileNames`, program.getRootFileNames(), expectedFiles);
}
export function createWatchOfConfigFileReturningBuilder(configFileName: string, host: WatchedSystem, maxNumberOfFilesToIterateForInvalidation?: number) {
const compilerHost = createWatchCompilerHostOfConfigFile(configFileName, {}, host);
compilerHost.maxNumberOfFilesToIterateForInvalidation = maxNumberOfFilesToIterateForInvalidation;
const watch = createWatchProgram(compilerHost);
return () => watch.getCurrentProgram();
}
export function createWatchOfConfigFile(configFileName: string, host: WatchedSystem, maxNumberOfFilesToIterateForInvalidation?: number) {
const compilerHost = createWatchCompilerHostOfConfigFile(configFileName, {}, host);
compilerHost.maxNumberOfFilesToIterateForInvalidation = maxNumberOfFilesToIterateForInvalidation;
@ -443,6 +450,33 @@ namespace ts.tscWatch {
checkOutputErrorsIncremental(host, emptyArray);
});
it("Updates diagnostics when '--noUnusedLabels' changes", () => {
const aTs: File = { path: "/a.ts", content: "label: while (1) {}" };
const files = [libFile, aTs];
const paths = files.map(f => f.path);
const options = (allowUnusedLabels: boolean) => `{ "compilerOptions": { "allowUnusedLabels": ${allowUnusedLabels} } }`;
const tsconfig: File = { path: "/tsconfig.json", content: options(/*allowUnusedLabels*/ true) };
const host = createWatchedSystem([...files, tsconfig]);
const watch = createWatchOfConfigFile(tsconfig.path, host);
checkProgramActualFiles(watch(), paths);
checkOutputErrorsInitial(host, emptyArray);
host.modifyFile(tsconfig.path, options(/*allowUnusedLabels*/ false));
host.checkTimeoutQueueLengthAndRun(1); // reload the configured project
checkProgramActualFiles(watch(), paths);
checkOutputErrorsIncremental(host, [
getDiagnosticOfFileFromProgram(watch(), aTs.path, 0, "label".length, Diagnostics.Unused_label),
]);
host.modifyFile(tsconfig.path, options(/*allowUnusedLabels*/ true));
host.checkTimeoutQueueLengthAndRun(1); // reload the configured project
checkProgramActualFiles(watch(), paths);
checkOutputErrorsIncremental(host, emptyArray);
});
it("files explicitly excluded in config file", () => {
const configFile: File = {
path: "/a/b/tsconfig.json",
@ -1190,7 +1224,7 @@ namespace ts.tscWatch {
host.reloadFS(files);
host.runQueuedTimeoutCallbacks();
checkProgramActualFiles(watch(), files.map(file => file.path));
checkOutputErrorsIncremental(host, []);
checkOutputErrorsIncremental(host, emptyArray);
});
it("watched files when file is deleted and new file is added as part of change", () => {
@ -1322,12 +1356,10 @@ export class B
path: `${currentDirectory}/a.ts`,
content: `declare function foo(): null | { hello: any };
foo().hello`
};
const compilerOptions: CompilerOptions = {
};
const config: File = {
path: `${currentDirectory}/tsconfig.json`,
content: JSON.stringify({ compilerOptions })
content: JSON.stringify({ compilerOptions: {} })
};
const files = [aFile, config, libFile];
const host = createWatchedSystem(files, { currentDirectory });
@ -1335,8 +1367,7 @@ foo().hello`
checkProgramActualFiles(watch(), [aFile.path, libFile.path]);
checkOutputErrorsInitial(host, emptyArray);
const modifiedTimeOfAJs = host.getModifiedTime(`${currentDirectory}/a.js`);
compilerOptions.strictNullChecks = true;
host.writeFile(config.path, JSON.stringify({ compilerOptions }));
host.writeFile(config.path, JSON.stringify({ compilerOptions: { strictNullChecks: true } }));
host.runQueuedTimeoutCallbacks();
const expectedStrictNullErrors = [
getDiagnosticOfFileFromProgram(watch(), aFile.path, aFile.content.lastIndexOf("foo()"), 5, Diagnostics.Object_is_possibly_null)
@ -1344,15 +1375,12 @@ foo().hello`
checkOutputErrorsIncremental(host, expectedStrictNullErrors);
// File a need not be rewritten
assert.equal(host.getModifiedTime(`${currentDirectory}/a.js`), modifiedTimeOfAJs);
compilerOptions.strict = true;
delete (compilerOptions.strictNullChecks);
host.writeFile(config.path, JSON.stringify({ compilerOptions }));
host.writeFile(config.path, JSON.stringify({ compilerOptions: { strict: true, alwaysStrict: false } })); // Avoid changing 'alwaysStrict' or must re-bind
host.runQueuedTimeoutCallbacks();
checkOutputErrorsIncremental(host, expectedStrictNullErrors);
// File a need not be rewritten
assert.equal(host.getModifiedTime(`${currentDirectory}/a.js`), modifiedTimeOfAJs);
delete (compilerOptions.strict);
host.writeFile(config.path, JSON.stringify({ compilerOptions }));
host.writeFile(config.path, JSON.stringify({ compilerOptions: {} }));
host.runQueuedTimeoutCallbacks();
checkOutputErrorsIncremental(host, emptyArray);
// File a need not be rewritten

View File

@ -456,7 +456,7 @@ namespace ts.projectSystem {
function protocolFileLocationFromSubstring(file: File, substring: string): protocol.FileLocationRequestArgs {
return { file: file.path, ...protocolLocationFromSubstring(file.content, substring) };
}
function protocolFileSpanFromSubstring(file: File, substring: string, options?: SpanFromSubstringOptions) {
function protocolFileSpanFromSubstring(file: File, substring: string, options?: SpanFromSubstringOptions): protocol.FileSpan {
return { file: file.path, ...protocolTextSpanFromSubstring(file.content, substring, options) };
}
function documentSpanFromSubstring(file: File, substring: string, options?: SpanFromSubstringOptions): DocumentSpan {
@ -3491,7 +3491,7 @@ namespace ts.projectSystem {
host.checkTimeoutQueueLength(2); // Update configured project and projects for open file
checkProjectActualFiles(services.configuredProjects.get(config.path)!, filesWithFileA.map(f => f.path));
// host.fileExists = originalFileExists;
// host.fileExists = originalFileExists;
openFile(fileSubA);
// This should create inferred project since fileSubA not on the disk
checkProjectActualFiles(services.configuredProjects.get(config.path)!, mapDefined(filesWithFileA, f => f === fileA ? undefined : f.path));
@ -3672,7 +3672,7 @@ namespace ts.projectSystem {
path: `${projectRoot}/app1/tsconfig.json`,
content: JSON.stringify({
files: ["app.ts", "../core/core.ts"],
compilerOptions: { outFile : "build/output.js" },
compilerOptions: { outFile: "build/output.js" },
compileOnSave: true
})
};
@ -6778,9 +6778,9 @@ namespace ts.projectSystem {
fileName: "/a.1.ts",
textChanges: [
{
start: { line: 0, offset: 0 },
end: { line: 0, offset: 0 },
newText: "export const a = 0;",
start: { line: 0, offset: 0 },
end: { line: 0, offset: 0 },
newText: "export const a = 0;",
},
],
}
@ -8287,7 +8287,8 @@ namespace ts.projectSystem {
protocolTextSpanFromSubstring(aFile.content, "C"),
protocolTextSpanFromSubstring(aFile.content, "C", { index: 1 }),
];
const cLocs: protocol.TextSpan[] = [protocolTextSpanFromSubstring(cFile.content, "C")];
const span = protocolTextSpanFromSubstring(cFile.content, "C");
const cLocs: protocol.TextSpan[] = [span];
assert.deepEqual<protocol.RenameResponseBody | undefined>(response, {
info: {
canRename: true,
@ -8296,6 +8297,7 @@ namespace ts.projectSystem {
kind: ScriptElementKind.constElement,
kindModifiers: ScriptElementKindModifier.exportedModifier,
localizedErrorMessage: undefined,
triggerSpan: span,
},
locs: [
{ file: aFc, locs: cLocs },
@ -8672,7 +8674,7 @@ new C();`
}));
checkWatchedDirectories(host, [], /*recursive*/ false);
checkWatchedDirectories(host, arrayFrom(expectedRecursiveDirectories.keys()), /*recursive*/ true);
}
}
describe("from files in same folder", () => {
function getFiles(fileContent: string) {
@ -9750,7 +9752,7 @@ declare class TestLib {
function verifyATsConfigOriginalProject(session: TestSession) {
checkNumberOfProjects(session.getProjectService(), { inferredProjects: 1, configuredProjects: 1 });
verifyInferredProjectUnchanged(session);
verifyATsConfigProject(session);
verifyATsConfigProject(session);
// Close user file should close all the projects
closeFilesForSession([userTs], session);
verifyOnlyOrphanInferredProject(session);
@ -9900,11 +9902,12 @@ declare class TestLib {
verifyATsConfigWhenOpened(session);
});
interface ReferencesFullRequest extends protocol.FileLocationRequest { readonly command: protocol.CommandTypes.ReferencesFull; }
interface ReferencesFullResponse extends protocol.Response { readonly body: ReadonlyArray<ReferencedSymbol>; }
it("findAllReferencesFull", () => {
const session = makeSampleProjects();
interface ReferencesFullRequest extends protocol.FileLocationRequest { command: protocol.CommandTypes.ReferencesFull; }
interface ReferencesFullResponse extends protocol.Response { body: ReadonlyArray<ReferencedSymbol>; }
const responseFull = executeSessionRequest<ReferencesFullRequest, ReferencesFullResponse>(session, protocol.CommandTypes.ReferencesFull, protocolFileLocationFromSubstring(userTs, "fnA()"));
function fnAVoid(kind: SymbolDisplayPartKind): SymbolDisplayPart[] {
@ -9961,6 +9964,67 @@ declare class TestLib {
verifyATsConfigOriginalProject(session);
});
it("findAllReferencesFull definition is in mapped file", () => {
const aTs: File = { path: "/a/a.ts", content: `function f() {}` };
const aTsconfig: File = {
path: "/a/tsconfig.json",
content: JSON.stringify({ compilerOptions: { declaration: true, declarationMap: true, outFile: "../bin/a.js" } }),
};
const bTs: File = { path: "/b/b.ts", content: `f();` };
const bTsconfig: File = { path: "/b/tsconfig.json", content: JSON.stringify({ references: [{ path: "../a" }] }) };
const aDts: File = { path: "/bin/a.d.ts", content: `declare function f(): void;\n//# sourceMappingURL=a.d.ts.map` };
const aDtsMap: File = {
path: "/bin/a.d.ts.map",
content: JSON.stringify({ version: 3, file: "a.d.ts", sourceRoot: "", sources: ["../a/a.ts"], names: [], mappings: "AAAA,iBAAS,CAAC,SAAK" }),
};
const session = createSession(createServerHost([aTs, aTsconfig, bTs, bTsconfig, aDts, aDtsMap]));
checkDeclarationFiles(aTs, session, [aDtsMap, aDts]);
openFilesForSession([bTs], session);
checkNumberOfProjects(session.getProjectService(), { configuredProjects: 1 });
const responseFull = executeSessionRequest<ReferencesFullRequest, ReferencesFullResponse>(session, protocol.CommandTypes.ReferencesFull, protocolFileLocationFromSubstring(bTs, "f()"));
assert.deepEqual<ReadonlyArray<ReferencedSymbol>>(responseFull, [
{
definition: {
containerKind: ScriptElementKind.unknown,
containerName: "",
displayParts: [
keywordPart(SyntaxKind.FunctionKeyword),
spacePart(),
displayPart("f", SymbolDisplayPartKind.functionName),
punctuationPart(SyntaxKind.OpenParenToken),
punctuationPart(SyntaxKind.CloseParenToken),
punctuationPart(SyntaxKind.ColonToken),
spacePart(),
keywordPart(SyntaxKind.VoidKeyword),
],
fileName: aTs.path,
kind: ScriptElementKind.functionElement,
name: "function f(): void",
textSpan: { start: 9, length: 1 },
},
references: [
{
fileName: bTs.path,
isDefinition: false,
isInString: undefined,
isWriteAccess: false,
textSpan: { start: 0, length: 1 },
},
{
fileName: aTs.path,
isDefinition: true,
isInString: undefined,
isWriteAccess: true,
textSpan: { start: 9, length: 1 },
},
],
}
]);
});
it("findAllReferences -- target does not exist", () => {
const session = makeSampleProjects();
@ -10001,6 +10065,7 @@ declare class TestLib {
kind: ScriptElementKind.alias,
kindModifiers: ScriptElementKindModifier.none,
localizedErrorMessage: undefined,
triggerSpan: protocolTextSpanFromSubstring(userTs.content, "fnA", { index: 1 }),
},
locs: [renameUserTs(userTs), renameATs(aTs)],
});
@ -10019,6 +10084,7 @@ declare class TestLib {
kind: ScriptElementKind.functionElement,
kindModifiers: ScriptElementKindModifier.exportedModifier,
localizedErrorMessage: undefined,
triggerSpan: protocolTextSpanFromSubstring(aTs.content, "fnA"),
},
locs: [renameATs(aTs), renameUserTs(userTs)],
});
@ -10047,6 +10113,7 @@ declare class TestLib {
kind: ScriptElementKind.alias,
kindModifiers: ScriptElementKindModifier.none,
localizedErrorMessage: undefined,
triggerSpan: protocolTextSpanFromSubstring(userTs.content, "fnB", { index: 1 }),
},
locs: [
{
@ -10180,6 +10247,35 @@ declare class TestLib {
});
});
describe("tsserverProjectSystem config file change", () => {
it("Updates diagnostics when '--noUnusedLabels' changes", () => {
const aTs: File = { path: "/a.ts", content: "label: while (1) {}" };
const options = (allowUnusedLabels: boolean) => `{ "compilerOptions": { "allowUnusedLabels": ${allowUnusedLabels} } }`;
const tsconfig: File = { path: "/tsconfig.json", content: options(/*allowUnusedLabels*/ true) };
const host = createServerHost([aTs, tsconfig]);
const session = createSession(host);
openFilesForSession([aTs], session);
host.modifyFile(tsconfig.path, options(/*allowUnusedLabels*/ false));
host.runQueuedTimeoutCallbacks();
const response = executeSessionRequest<protocol.SemanticDiagnosticsSyncRequest, protocol.SemanticDiagnosticsSyncResponse>(session, protocol.CommandTypes.SemanticDiagnosticsSync, { file: aTs.path }) as protocol.Diagnostic[] | undefined;
assert.deepEqual<protocol.Diagnostic[] | undefined>(response, [
{
start: { line: 1, offset: 1 },
end: { line: 1, offset: 1 + "label".length },
text: "Unused label.",
category: "error",
code: Diagnostics.Unused_label.code,
relatedInformation: undefined,
reportsUnnecessary: true,
source: undefined,
},
]);
});
});
function makeReferenceItem(file: File, isDefinition: boolean, text: string, lineText: string, options?: SpanFromSubstringOptions): protocol.ReferencesResponseItem {
return {
...protocolFileSpanFromSubstring(file, text, options),

View File

@ -2,9 +2,10 @@ tests/cases/compiler/abstractPropertyInConstructor.ts(4,24): error TS2715: Abstr
tests/cases/compiler/abstractPropertyInConstructor.ts(7,18): error TS2715: Abstract property 'prop' in class 'AbstractClass' cannot be accessed in the constructor.
tests/cases/compiler/abstractPropertyInConstructor.ts(9,14): error TS2715: Abstract property 'cb' in class 'AbstractClass' cannot be accessed in the constructor.
tests/cases/compiler/abstractPropertyInConstructor.ts(25,18): error TS2715: Abstract property 'prop' in class 'AbstractClass' cannot be accessed in the constructor.
tests/cases/compiler/abstractPropertyInConstructor.ts(39,22): error TS2715: Abstract property 'prop' in class 'AbstractClass' cannot be accessed in the constructor.
==== tests/cases/compiler/abstractPropertyInConstructor.ts (4 errors) ====
==== tests/cases/compiler/abstractPropertyInConstructor.ts (5 errors) ====
abstract class AbstractClass {
constructor(str: string, other: AbstractClass) {
this.method(parseInt(str));
@ -45,6 +46,38 @@ tests/cases/compiler/abstractPropertyInConstructor.ts(25,18): error TS2715: Abst
}
}
abstract class DerivedAbstractClass extends AbstractClass {
cb = (s: string) => {};
constructor(str: string, other: AbstractClass, yetAnother: DerivedAbstractClass) {
super(str, other);
// there is no implementation of 'prop' in any base class
this.cb(this.prop.toLowerCase());
~~~~
!!! error TS2715: Abstract property 'prop' in class 'AbstractClass' cannot be accessed in the constructor.
this.method(1);
// OK, references are to another instance
other.cb(other.prop);
yetAnother.cb(yetAnother.prop);
}
}
class Implementation extends DerivedAbstractClass {
prop = "";
cb = (s: string) => {};
constructor(str: string, other: AbstractClass, yetAnother: DerivedAbstractClass) {
super(str, other, yetAnother);
this.cb(this.prop);
}
method(n: number) {
this.cb(this.prop + n);
}
}
class User {
constructor(a: AbstractClass) {
a.prop;

View File

@ -31,6 +31,36 @@ abstract class AbstractClass {
}
}
abstract class DerivedAbstractClass extends AbstractClass {
cb = (s: string) => {};
constructor(str: string, other: AbstractClass, yetAnother: DerivedAbstractClass) {
super(str, other);
// there is no implementation of 'prop' in any base class
this.cb(this.prop.toLowerCase());
this.method(1);
// OK, references are to another instance
other.cb(other.prop);
yetAnother.cb(yetAnother.prop);
}
}
class Implementation extends DerivedAbstractClass {
prop = "";
cb = (s: string) => {};
constructor(str: string, other: AbstractClass, yetAnother: DerivedAbstractClass) {
super(str, other, yetAnother);
this.cb(this.prop);
}
method(n: number) {
this.cb(this.prop + n);
}
}
class User {
constructor(a: AbstractClass) {
a.prop;
@ -42,6 +72,19 @@ class User {
//// [abstractPropertyInConstructor.js]
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
}
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var AbstractClass = /** @class */ (function () {
function AbstractClass(str, other) {
var _this = this;
@ -65,6 +108,35 @@ var AbstractClass = /** @class */ (function () {
};
return AbstractClass;
}());
var DerivedAbstractClass = /** @class */ (function (_super) {
__extends(DerivedAbstractClass, _super);
function DerivedAbstractClass(str, other, yetAnother) {
var _this = _super.call(this, str, other) || this;
_this.cb = function (s) { };
// there is no implementation of 'prop' in any base class
_this.cb(_this.prop.toLowerCase());
_this.method(1);
// OK, references are to another instance
other.cb(other.prop);
yetAnother.cb(yetAnother.prop);
return _this;
}
return DerivedAbstractClass;
}(AbstractClass));
var Implementation = /** @class */ (function (_super) {
__extends(Implementation, _super);
function Implementation(str, other, yetAnother) {
var _this = _super.call(this, str, other, yetAnother) || this;
_this.prop = "";
_this.cb = function (s) { };
_this.cb(_this.prop);
return _this;
}
Implementation.prototype.method = function (n) {
this.cb(this.prop + n);
};
return Implementation;
}(DerivedAbstractClass));
var User = /** @class */ (function () {
function User(a) {
a.prop;

View File

@ -92,31 +92,134 @@ abstract class AbstractClass {
}
}
abstract class DerivedAbstractClass extends AbstractClass {
>DerivedAbstractClass : Symbol(DerivedAbstractClass, Decl(abstractPropertyInConstructor.ts, 30, 1))
>AbstractClass : Symbol(AbstractClass, Decl(abstractPropertyInConstructor.ts, 0, 0))
cb = (s: string) => {};
>cb : Symbol(DerivedAbstractClass.cb, Decl(abstractPropertyInConstructor.ts, 32, 59))
>s : Symbol(s, Decl(abstractPropertyInConstructor.ts, 33, 10))
constructor(str: string, other: AbstractClass, yetAnother: DerivedAbstractClass) {
>str : Symbol(str, Decl(abstractPropertyInConstructor.ts, 35, 16))
>other : Symbol(other, Decl(abstractPropertyInConstructor.ts, 35, 28))
>AbstractClass : Symbol(AbstractClass, Decl(abstractPropertyInConstructor.ts, 0, 0))
>yetAnother : Symbol(yetAnother, Decl(abstractPropertyInConstructor.ts, 35, 50))
>DerivedAbstractClass : Symbol(DerivedAbstractClass, Decl(abstractPropertyInConstructor.ts, 30, 1))
super(str, other);
>super : Symbol(AbstractClass, Decl(abstractPropertyInConstructor.ts, 0, 0))
>str : Symbol(str, Decl(abstractPropertyInConstructor.ts, 35, 16))
>other : Symbol(other, Decl(abstractPropertyInConstructor.ts, 35, 28))
// there is no implementation of 'prop' in any base class
this.cb(this.prop.toLowerCase());
>this.cb : Symbol(DerivedAbstractClass.cb, Decl(abstractPropertyInConstructor.ts, 32, 59))
>this : Symbol(DerivedAbstractClass, Decl(abstractPropertyInConstructor.ts, 30, 1))
>cb : Symbol(DerivedAbstractClass.cb, Decl(abstractPropertyInConstructor.ts, 32, 59))
>this.prop.toLowerCase : Symbol(String.toLowerCase, Decl(lib.es5.d.ts, --, --))
>this.prop : Symbol(AbstractClass.prop, Decl(abstractPropertyInConstructor.ts, 17, 5))
>this : Symbol(DerivedAbstractClass, Decl(abstractPropertyInConstructor.ts, 30, 1))
>prop : Symbol(AbstractClass.prop, Decl(abstractPropertyInConstructor.ts, 17, 5))
>toLowerCase : Symbol(String.toLowerCase, Decl(lib.es5.d.ts, --, --))
this.method(1);
>this.method : Symbol(AbstractClass.method, Decl(abstractPropertyInConstructor.ts, 20, 37))
>this : Symbol(DerivedAbstractClass, Decl(abstractPropertyInConstructor.ts, 30, 1))
>method : Symbol(AbstractClass.method, Decl(abstractPropertyInConstructor.ts, 20, 37))
// OK, references are to another instance
other.cb(other.prop);
>other.cb : Symbol(AbstractClass.cb, Decl(abstractPropertyInConstructor.ts, 19, 26))
>other : Symbol(other, Decl(abstractPropertyInConstructor.ts, 35, 28))
>cb : Symbol(AbstractClass.cb, Decl(abstractPropertyInConstructor.ts, 19, 26))
>other.prop : Symbol(AbstractClass.prop, Decl(abstractPropertyInConstructor.ts, 17, 5))
>other : Symbol(other, Decl(abstractPropertyInConstructor.ts, 35, 28))
>prop : Symbol(AbstractClass.prop, Decl(abstractPropertyInConstructor.ts, 17, 5))
yetAnother.cb(yetAnother.prop);
>yetAnother.cb : Symbol(DerivedAbstractClass.cb, Decl(abstractPropertyInConstructor.ts, 32, 59))
>yetAnother : Symbol(yetAnother, Decl(abstractPropertyInConstructor.ts, 35, 50))
>cb : Symbol(DerivedAbstractClass.cb, Decl(abstractPropertyInConstructor.ts, 32, 59))
>yetAnother.prop : Symbol(AbstractClass.prop, Decl(abstractPropertyInConstructor.ts, 17, 5))
>yetAnother : Symbol(yetAnother, Decl(abstractPropertyInConstructor.ts, 35, 50))
>prop : Symbol(AbstractClass.prop, Decl(abstractPropertyInConstructor.ts, 17, 5))
}
}
class Implementation extends DerivedAbstractClass {
>Implementation : Symbol(Implementation, Decl(abstractPropertyInConstructor.ts, 46, 1))
>DerivedAbstractClass : Symbol(DerivedAbstractClass, Decl(abstractPropertyInConstructor.ts, 30, 1))
prop = "";
>prop : Symbol(Implementation.prop, Decl(abstractPropertyInConstructor.ts, 48, 51))
cb = (s: string) => {};
>cb : Symbol(Implementation.cb, Decl(abstractPropertyInConstructor.ts, 49, 14))
>s : Symbol(s, Decl(abstractPropertyInConstructor.ts, 50, 10))
constructor(str: string, other: AbstractClass, yetAnother: DerivedAbstractClass) {
>str : Symbol(str, Decl(abstractPropertyInConstructor.ts, 52, 16))
>other : Symbol(other, Decl(abstractPropertyInConstructor.ts, 52, 28))
>AbstractClass : Symbol(AbstractClass, Decl(abstractPropertyInConstructor.ts, 0, 0))
>yetAnother : Symbol(yetAnother, Decl(abstractPropertyInConstructor.ts, 52, 50))
>DerivedAbstractClass : Symbol(DerivedAbstractClass, Decl(abstractPropertyInConstructor.ts, 30, 1))
super(str, other, yetAnother);
>super : Symbol(DerivedAbstractClass, Decl(abstractPropertyInConstructor.ts, 30, 1))
>str : Symbol(str, Decl(abstractPropertyInConstructor.ts, 52, 16))
>other : Symbol(other, Decl(abstractPropertyInConstructor.ts, 52, 28))
>yetAnother : Symbol(yetAnother, Decl(abstractPropertyInConstructor.ts, 52, 50))
this.cb(this.prop);
>this.cb : Symbol(Implementation.cb, Decl(abstractPropertyInConstructor.ts, 49, 14))
>this : Symbol(Implementation, Decl(abstractPropertyInConstructor.ts, 46, 1))
>cb : Symbol(Implementation.cb, Decl(abstractPropertyInConstructor.ts, 49, 14))
>this.prop : Symbol(Implementation.prop, Decl(abstractPropertyInConstructor.ts, 48, 51))
>this : Symbol(Implementation, Decl(abstractPropertyInConstructor.ts, 46, 1))
>prop : Symbol(Implementation.prop, Decl(abstractPropertyInConstructor.ts, 48, 51))
}
method(n: number) {
>method : Symbol(Implementation.method, Decl(abstractPropertyInConstructor.ts, 55, 5))
>n : Symbol(n, Decl(abstractPropertyInConstructor.ts, 57, 11))
this.cb(this.prop + n);
>this.cb : Symbol(Implementation.cb, Decl(abstractPropertyInConstructor.ts, 49, 14))
>this : Symbol(Implementation, Decl(abstractPropertyInConstructor.ts, 46, 1))
>cb : Symbol(Implementation.cb, Decl(abstractPropertyInConstructor.ts, 49, 14))
>this.prop : Symbol(Implementation.prop, Decl(abstractPropertyInConstructor.ts, 48, 51))
>this : Symbol(Implementation, Decl(abstractPropertyInConstructor.ts, 46, 1))
>prop : Symbol(Implementation.prop, Decl(abstractPropertyInConstructor.ts, 48, 51))
>n : Symbol(n, Decl(abstractPropertyInConstructor.ts, 57, 11))
}
}
class User {
>User : Symbol(User, Decl(abstractPropertyInConstructor.ts, 30, 1))
>User : Symbol(User, Decl(abstractPropertyInConstructor.ts, 60, 1))
constructor(a: AbstractClass) {
>a : Symbol(a, Decl(abstractPropertyInConstructor.ts, 33, 16))
>a : Symbol(a, Decl(abstractPropertyInConstructor.ts, 63, 16))
>AbstractClass : Symbol(AbstractClass, Decl(abstractPropertyInConstructor.ts, 0, 0))
a.prop;
>a.prop : Symbol(AbstractClass.prop, Decl(abstractPropertyInConstructor.ts, 17, 5))
>a : Symbol(a, Decl(abstractPropertyInConstructor.ts, 33, 16))
>a : Symbol(a, Decl(abstractPropertyInConstructor.ts, 63, 16))
>prop : Symbol(AbstractClass.prop, Decl(abstractPropertyInConstructor.ts, 17, 5))
a.cb("hi");
>a.cb : Symbol(AbstractClass.cb, Decl(abstractPropertyInConstructor.ts, 19, 26))
>a : Symbol(a, Decl(abstractPropertyInConstructor.ts, 33, 16))
>a : Symbol(a, Decl(abstractPropertyInConstructor.ts, 63, 16))
>cb : Symbol(AbstractClass.cb, Decl(abstractPropertyInConstructor.ts, 19, 26))
a.method(12);
>a.method : Symbol(AbstractClass.method, Decl(abstractPropertyInConstructor.ts, 20, 37))
>a : Symbol(a, Decl(abstractPropertyInConstructor.ts, 33, 16))
>a : Symbol(a, Decl(abstractPropertyInConstructor.ts, 63, 16))
>method : Symbol(AbstractClass.method, Decl(abstractPropertyInConstructor.ts, 20, 37))
a.method2();
>a.method2 : Symbol(AbstractClass.method2, Decl(abstractPropertyInConstructor.ts, 25, 25))
>a : Symbol(a, Decl(abstractPropertyInConstructor.ts, 33, 16))
>a : Symbol(a, Decl(abstractPropertyInConstructor.ts, 63, 16))
>method2 : Symbol(AbstractClass.method2, Decl(abstractPropertyInConstructor.ts, 25, 25))
}
}

View File

@ -104,6 +104,119 @@ abstract class AbstractClass {
}
}
abstract class DerivedAbstractClass extends AbstractClass {
>DerivedAbstractClass : DerivedAbstractClass
>AbstractClass : AbstractClass
cb = (s: string) => {};
>cb : (s: string) => void
>(s: string) => {} : (s: string) => void
>s : string
constructor(str: string, other: AbstractClass, yetAnother: DerivedAbstractClass) {
>str : string
>other : AbstractClass
>yetAnother : DerivedAbstractClass
super(str, other);
>super(str, other) : void
>super : typeof AbstractClass
>str : string
>other : AbstractClass
// there is no implementation of 'prop' in any base class
this.cb(this.prop.toLowerCase());
>this.cb(this.prop.toLowerCase()) : void
>this.cb : (s: string) => void
>this : this
>cb : (s: string) => void
>this.prop.toLowerCase() : string
>this.prop.toLowerCase : () => string
>this.prop : string
>this : this
>prop : string
>toLowerCase : () => string
this.method(1);
>this.method(1) : void
>this.method : (num: number) => void
>this : this
>method : (num: number) => void
>1 : 1
// OK, references are to another instance
other.cb(other.prop);
>other.cb(other.prop) : void
>other.cb : (s: string) => void
>other : AbstractClass
>cb : (s: string) => void
>other.prop : string
>other : AbstractClass
>prop : string
yetAnother.cb(yetAnother.prop);
>yetAnother.cb(yetAnother.prop) : void
>yetAnother.cb : (s: string) => void
>yetAnother : DerivedAbstractClass
>cb : (s: string) => void
>yetAnother.prop : string
>yetAnother : DerivedAbstractClass
>prop : string
}
}
class Implementation extends DerivedAbstractClass {
>Implementation : Implementation
>DerivedAbstractClass : DerivedAbstractClass
prop = "";
>prop : string
>"" : ""
cb = (s: string) => {};
>cb : (s: string) => void
>(s: string) => {} : (s: string) => void
>s : string
constructor(str: string, other: AbstractClass, yetAnother: DerivedAbstractClass) {
>str : string
>other : AbstractClass
>yetAnother : DerivedAbstractClass
super(str, other, yetAnother);
>super(str, other, yetAnother) : void
>super : typeof DerivedAbstractClass
>str : string
>other : AbstractClass
>yetAnother : DerivedAbstractClass
this.cb(this.prop);
>this.cb(this.prop) : void
>this.cb : (s: string) => void
>this : this
>cb : (s: string) => void
>this.prop : string
>this : this
>prop : string
}
method(n: number) {
>method : (n: number) => void
>n : number
this.cb(this.prop + n);
>this.cb(this.prop + n) : void
>this.cb : (s: string) => void
>this : this
>cb : (s: string) => void
>this.prop + n : string
>this.prop : string
>this : this
>prop : string
>n : number
}
}
class User {
>User : User

View File

@ -6455,6 +6455,8 @@ declare namespace ts.server.protocol {
* Optional modifiers for the kind (such as 'public').
*/
kindModifiers: string;
/** Span of text to rename. */
triggerSpan: TextSpan;
}
/**
* A group of text spans, all in 'file'.
@ -8733,7 +8735,7 @@ declare namespace ts.server {
private getProjects;
private getDefaultProject;
private getRenameLocations;
private static mapRenameInfo;
private mapRenameInfo;
private toSpanGroups;
private getReferences;
/**

View File

@ -0,0 +1,9 @@
tests/cases/conformance/jsdoc/bug27142.js(1,12): error TS2586: Enum type 'E' circularly references itself.
==== tests/cases/conformance/jsdoc/bug27142.js (1 errors) ====
/** @enum {E} */
~
!!! error TS2586: Enum type 'E' circularly references itself.
const E = { x: 0 };

View File

@ -0,0 +1,6 @@
=== tests/cases/conformance/jsdoc/bug27142.js ===
/** @enum {E} */
const E = { x: 0 };
>E : Symbol(E, Decl(bug27142.js, 1, 5))
>x : Symbol(x, Decl(bug27142.js, 1, 11))

View File

@ -0,0 +1,8 @@
=== tests/cases/conformance/jsdoc/bug27142.js ===
/** @enum {E} */
const E = { x: 0 };
>E : { x: number; }
>{ x: 0 } : { x: number; }
>x : number
>0 : 0

View File

@ -0,0 +1,15 @@
//// [tests/cases/compiler/esModuleInteropEnablesSyntheticDefaultImports.ts] ////
//// [a.ts]
import Namespace from "./b";
export var x = new Namespace.Foo();
//// [b.d.ts]
export class Foo {
member: string;
}
//// [a.js]
import Namespace from "./b";
export var x = new Namespace.Foo();

View File

@ -0,0 +1,18 @@
=== tests/cases/compiler/a.ts ===
import Namespace from "./b";
>Namespace : Symbol(Namespace, Decl(a.ts, 0, 6))
export var x = new Namespace.Foo();
>x : Symbol(x, Decl(a.ts, 1, 10))
>Namespace.Foo : Symbol(Namespace.Foo, Decl(b.d.ts, 0, 0))
>Namespace : Symbol(Namespace, Decl(a.ts, 0, 6))
>Foo : Symbol(Namespace.Foo, Decl(b.d.ts, 0, 0))
=== tests/cases/compiler/b.d.ts ===
export class Foo {
>Foo : Symbol(Foo, Decl(b.d.ts, 0, 0))
member: string;
>member : Symbol(Foo.member, Decl(b.d.ts, 0, 18))
}

View File

@ -0,0 +1,19 @@
=== tests/cases/compiler/a.ts ===
import Namespace from "./b";
>Namespace : typeof Namespace
export var x = new Namespace.Foo();
>x : Namespace.Foo
>new Namespace.Foo() : Namespace.Foo
>Namespace.Foo : typeof Namespace.Foo
>Namespace : typeof Namespace
>Foo : typeof Namespace.Foo
=== tests/cases/compiler/b.d.ts ===
export class Foo {
>Foo : Foo
member: string;
>member : string
}

View File

@ -0,0 +1,38 @@
tests/cases/compiler/extractInferenceImprovement.ts(26,26): error TS2345: Argument of type 'unique symbol' is not assignable to parameter of type 'never'.
tests/cases/compiler/extractInferenceImprovement.ts(28,26): error TS2345: Argument of type 'unique symbol' is not assignable to parameter of type '"first" | "second"'.
==== tests/cases/compiler/extractInferenceImprovement.ts (2 errors) ====
// repro mostly from https://github.com/Microsoft/TypeScript/issues/25065
function getProperty2<T, K extends keyof T>(obj: T, key: Extract<K, string>): T[K] {
return obj[key];
}
function getProperty3<T, K extends Extract<keyof T, string>>(obj: T, key: K): T[K] {
return obj[key];
}
const s = Symbol();
interface StrNum {
first: string;
second: number;
[s]: string;
}
const obj: StrNum = {} as any;
let prop: string;
// should work
prop = getProperty2(obj, 'first');
prop = getProperty3(obj, 'first');
// Should fail
prop = getProperty2(obj, s);
~
!!! error TS2345: Argument of type 'unique symbol' is not assignable to parameter of type 'never'.
prop = getProperty3(obj, s);
~
!!! error TS2345: Argument of type 'unique symbol' is not assignable to parameter of type '"first" | "second"'.

View File

@ -0,0 +1,48 @@
//// [extractInferenceImprovement.ts]
// repro mostly from https://github.com/Microsoft/TypeScript/issues/25065
function getProperty2<T, K extends keyof T>(obj: T, key: Extract<K, string>): T[K] {
return obj[key];
}
function getProperty3<T, K extends Extract<keyof T, string>>(obj: T, key: K): T[K] {
return obj[key];
}
const s = Symbol();
interface StrNum {
first: string;
second: number;
[s]: string;
}
const obj: StrNum = {} as any;
let prop: string;
// should work
prop = getProperty2(obj, 'first');
prop = getProperty3(obj, 'first');
// Should fail
prop = getProperty2(obj, s);
prop = getProperty3(obj, s);
//// [extractInferenceImprovement.js]
// repro mostly from https://github.com/Microsoft/TypeScript/issues/25065
function getProperty2(obj, key) {
return obj[key];
}
function getProperty3(obj, key) {
return obj[key];
}
const s = Symbol();
const obj = {};
let prop;
// should work
prop = getProperty2(obj, 'first');
prop = getProperty3(obj, 'first');
// Should fail
prop = getProperty2(obj, s);
prop = getProperty3(obj, s);

View File

@ -0,0 +1,86 @@
=== tests/cases/compiler/extractInferenceImprovement.ts ===
// repro mostly from https://github.com/Microsoft/TypeScript/issues/25065
function getProperty2<T, K extends keyof T>(obj: T, key: Extract<K, string>): T[K] {
>getProperty2 : Symbol(getProperty2, Decl(extractInferenceImprovement.ts, 0, 0))
>T : Symbol(T, Decl(extractInferenceImprovement.ts, 1, 22))
>K : Symbol(K, Decl(extractInferenceImprovement.ts, 1, 24))
>T : Symbol(T, Decl(extractInferenceImprovement.ts, 1, 22))
>obj : Symbol(obj, Decl(extractInferenceImprovement.ts, 1, 44))
>T : Symbol(T, Decl(extractInferenceImprovement.ts, 1, 22))
>key : Symbol(key, Decl(extractInferenceImprovement.ts, 1, 51))
>Extract : Symbol(Extract, Decl(lib.es5.d.ts, --, --))
>K : Symbol(K, Decl(extractInferenceImprovement.ts, 1, 24))
>T : Symbol(T, Decl(extractInferenceImprovement.ts, 1, 22))
>K : Symbol(K, Decl(extractInferenceImprovement.ts, 1, 24))
return obj[key];
>obj : Symbol(obj, Decl(extractInferenceImprovement.ts, 1, 44))
>key : Symbol(key, Decl(extractInferenceImprovement.ts, 1, 51))
}
function getProperty3<T, K extends Extract<keyof T, string>>(obj: T, key: K): T[K] {
>getProperty3 : Symbol(getProperty3, Decl(extractInferenceImprovement.ts, 3, 1))
>T : Symbol(T, Decl(extractInferenceImprovement.ts, 5, 22))
>K : Symbol(K, Decl(extractInferenceImprovement.ts, 5, 24))
>Extract : Symbol(Extract, Decl(lib.es5.d.ts, --, --))
>T : Symbol(T, Decl(extractInferenceImprovement.ts, 5, 22))
>obj : Symbol(obj, Decl(extractInferenceImprovement.ts, 5, 61))
>T : Symbol(T, Decl(extractInferenceImprovement.ts, 5, 22))
>key : Symbol(key, Decl(extractInferenceImprovement.ts, 5, 68))
>K : Symbol(K, Decl(extractInferenceImprovement.ts, 5, 24))
>T : Symbol(T, Decl(extractInferenceImprovement.ts, 5, 22))
>K : Symbol(K, Decl(extractInferenceImprovement.ts, 5, 24))
return obj[key];
>obj : Symbol(obj, Decl(extractInferenceImprovement.ts, 5, 61))
>key : Symbol(key, Decl(extractInferenceImprovement.ts, 5, 68))
}
const s = Symbol();
>s : Symbol(s, Decl(extractInferenceImprovement.ts, 9, 5))
>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --))
interface StrNum {
>StrNum : Symbol(StrNum, Decl(extractInferenceImprovement.ts, 9, 19))
first: string;
>first : Symbol(StrNum.first, Decl(extractInferenceImprovement.ts, 10, 18))
second: number;
>second : Symbol(StrNum.second, Decl(extractInferenceImprovement.ts, 11, 18))
[s]: string;
>[s] : Symbol(StrNum[s], Decl(extractInferenceImprovement.ts, 12, 19))
>s : Symbol(s, Decl(extractInferenceImprovement.ts, 9, 5))
}
const obj: StrNum = {} as any;
>obj : Symbol(obj, Decl(extractInferenceImprovement.ts, 15, 5))
>StrNum : Symbol(StrNum, Decl(extractInferenceImprovement.ts, 9, 19))
let prop: string;
>prop : Symbol(prop, Decl(extractInferenceImprovement.ts, 17, 3))
// should work
prop = getProperty2(obj, 'first');
>prop : Symbol(prop, Decl(extractInferenceImprovement.ts, 17, 3))
>getProperty2 : Symbol(getProperty2, Decl(extractInferenceImprovement.ts, 0, 0))
>obj : Symbol(obj, Decl(extractInferenceImprovement.ts, 15, 5))
prop = getProperty3(obj, 'first');
>prop : Symbol(prop, Decl(extractInferenceImprovement.ts, 17, 3))
>getProperty3 : Symbol(getProperty3, Decl(extractInferenceImprovement.ts, 3, 1))
>obj : Symbol(obj, Decl(extractInferenceImprovement.ts, 15, 5))
// Should fail
prop = getProperty2(obj, s);
>prop : Symbol(prop, Decl(extractInferenceImprovement.ts, 17, 3))
>getProperty2 : Symbol(getProperty2, Decl(extractInferenceImprovement.ts, 0, 0))
>obj : Symbol(obj, Decl(extractInferenceImprovement.ts, 15, 5))
>s : Symbol(s, Decl(extractInferenceImprovement.ts, 9, 5))
prop = getProperty3(obj, s);
>prop : Symbol(prop, Decl(extractInferenceImprovement.ts, 17, 3))
>getProperty3 : Symbol(getProperty3, Decl(extractInferenceImprovement.ts, 3, 1))
>obj : Symbol(obj, Decl(extractInferenceImprovement.ts, 15, 5))
>s : Symbol(s, Decl(extractInferenceImprovement.ts, 9, 5))

View File

@ -0,0 +1,82 @@
=== tests/cases/compiler/extractInferenceImprovement.ts ===
// repro mostly from https://github.com/Microsoft/TypeScript/issues/25065
function getProperty2<T, K extends keyof T>(obj: T, key: Extract<K, string>): T[K] {
>getProperty2 : <T, K extends keyof T>(obj: T, key: Extract<K, string>) => T[K]
>obj : T
>key : Extract<K, string>
return obj[key];
>obj[key] : T[Extract<K, string>]
>obj : T
>key : Extract<K, string>
}
function getProperty3<T, K extends Extract<keyof T, string>>(obj: T, key: K): T[K] {
>getProperty3 : <T, K extends Extract<keyof T, string>>(obj: T, key: K) => T[K]
>obj : T
>key : K
return obj[key];
>obj[key] : T[K]
>obj : T
>key : K
}
const s = Symbol();
>s : unique symbol
>Symbol() : unique symbol
>Symbol : SymbolConstructor
interface StrNum {
first: string;
>first : string
second: number;
>second : number
[s]: string;
>[s] : string
>s : unique symbol
}
const obj: StrNum = {} as any;
>obj : StrNum
>{} as any : any
>{} : {}
let prop: string;
>prop : string
// should work
prop = getProperty2(obj, 'first');
>prop = getProperty2(obj, 'first') : string
>prop : string
>getProperty2(obj, 'first') : string
>getProperty2 : <T, K extends keyof T>(obj: T, key: Extract<K, string>) => T[K]
>obj : StrNum
>'first' : "first"
prop = getProperty3(obj, 'first');
>prop = getProperty3(obj, 'first') : string
>prop : string
>getProperty3(obj, 'first') : string
>getProperty3 : <T, K extends Extract<keyof T, string>>(obj: T, key: K) => T[K]
>obj : StrNum
>'first' : "first"
// Should fail
prop = getProperty2(obj, s);
>prop = getProperty2(obj, s) : any
>prop : string
>getProperty2(obj, s) : any
>getProperty2 : <T, K extends keyof T>(obj: T, key: Extract<K, string>) => T[K]
>obj : StrNum
>s : unique symbol
prop = getProperty3(obj, s);
>prop = getProperty3(obj, s) : any
>prop : string
>getProperty3(obj, s) : any
>getProperty3 : <T, K extends Extract<keyof T, string>>(obj: T, key: K) => T[K]
>obj : StrNum
>s : unique symbol

View File

@ -0,0 +1,85 @@
tests/cases/conformance/salsa/typeFromPropertyAssignment36.ts(11,7): error TS2565: Property 'q' is used before being assigned.
tests/cases/conformance/salsa/typeFromPropertyAssignment36.ts(42,3): error TS2565: Property 'q' is used before being assigned.
tests/cases/conformance/salsa/typeFromPropertyAssignment36.ts(64,3): error TS2565: Property 'expando' is used before being assigned.
==== tests/cases/conformance/salsa/typeFromPropertyAssignment36.ts (3 errors) ====
function f(b: boolean) {
function d() {
}
d.e = 12
d.e
if (b) {
d.q = false
}
// error d.q might not be assigned
d.q
~
!!! error TS2565: Property 'q' is used before being assigned.
if (b) {
d.q = false
}
else {
d.q = true
}
d.q
if (b) {
d.r = 1
}
else {
d.r = 2
}
d.r
if (b) {
d.s = 'hi'
}
return d
}
// OK to access possibly-unassigned properties outside the initialising scope
var test = f(true).s
function d() {
}
d.e = 12
d.e
if (!!false) {
d.q = false
}
d.q
~
!!! error TS2565: Property 'q' is used before being assigned.
if (!!false) {
d.q = false
}
else {
d.q = true
}
d.q
if (!!false) {
d.r = 1
}
else {
d.r = 2
}
d.r
// test function expressions too
const g = function() {
}
if (!!false) {
g.expando = 1
}
g.expando // error
~~~~~~~
!!! error TS2565: Property 'expando' is used before being assigned.
if (!!false) {
g.both = 'hi'
}
else {
g.both = 0
}
g.both

View File

@ -0,0 +1,144 @@
//// [typeFromPropertyAssignment36.ts]
function f(b: boolean) {
function d() {
}
d.e = 12
d.e
if (b) {
d.q = false
}
// error d.q might not be assigned
d.q
if (b) {
d.q = false
}
else {
d.q = true
}
d.q
if (b) {
d.r = 1
}
else {
d.r = 2
}
d.r
if (b) {
d.s = 'hi'
}
return d
}
// OK to access possibly-unassigned properties outside the initialising scope
var test = f(true).s
function d() {
}
d.e = 12
d.e
if (!!false) {
d.q = false
}
d.q
if (!!false) {
d.q = false
}
else {
d.q = true
}
d.q
if (!!false) {
d.r = 1
}
else {
d.r = 2
}
d.r
// test function expressions too
const g = function() {
}
if (!!false) {
g.expando = 1
}
g.expando // error
if (!!false) {
g.both = 'hi'
}
else {
g.both = 0
}
g.both
//// [typeFromPropertyAssignment36.js]
"use strict";
function f(b) {
function d() {
}
d.e = 12;
d.e;
if (b) {
d.q = false;
}
// error d.q might not be assigned
d.q;
if (b) {
d.q = false;
}
else {
d.q = true;
}
d.q;
if (b) {
d.r = 1;
}
else {
d.r = 2;
}
d.r;
if (b) {
d.s = 'hi';
}
return d;
}
// OK to access possibly-unassigned properties outside the initialising scope
var test = f(true).s;
function d() {
}
d.e = 12;
d.e;
if (!!false) {
d.q = false;
}
d.q;
if (!!false) {
d.q = false;
}
else {
d.q = true;
}
d.q;
if (!!false) {
d.r = 1;
}
else {
d.r = 2;
}
d.r;
// test function expressions too
var g = function () {
};
if (!!false) {
g.expando = 1;
}
g.expando; // error
if (!!false) {
g.both = 'hi';
}
else {
g.both = 0;
}
g.both;

View File

@ -0,0 +1,178 @@
=== tests/cases/conformance/salsa/typeFromPropertyAssignment36.ts ===
function f(b: boolean) {
>f : Symbol(f, Decl(typeFromPropertyAssignment36.ts, 0, 0))
>b : Symbol(b, Decl(typeFromPropertyAssignment36.ts, 0, 11))
function d() {
>d : Symbol(d, Decl(typeFromPropertyAssignment36.ts, 0, 24))
}
d.e = 12
>d.e : Symbol(d.e, Decl(typeFromPropertyAssignment36.ts, 2, 5))
>d : Symbol(d, Decl(typeFromPropertyAssignment36.ts, 0, 24))
>e : Symbol(d.e, Decl(typeFromPropertyAssignment36.ts, 2, 5))
d.e
>d.e : Symbol(d.e, Decl(typeFromPropertyAssignment36.ts, 2, 5))
>d : Symbol(d, Decl(typeFromPropertyAssignment36.ts, 0, 24))
>e : Symbol(d.e, Decl(typeFromPropertyAssignment36.ts, 2, 5))
if (b) {
>b : Symbol(b, Decl(typeFromPropertyAssignment36.ts, 0, 11))
d.q = false
>d.q : Symbol(d.q, Decl(typeFromPropertyAssignment36.ts, 6, 12), Decl(typeFromPropertyAssignment36.ts, 11, 12), Decl(typeFromPropertyAssignment36.ts, 14, 10))
>d : Symbol(d, Decl(typeFromPropertyAssignment36.ts, 0, 24))
>q : Symbol(d.q, Decl(typeFromPropertyAssignment36.ts, 6, 12), Decl(typeFromPropertyAssignment36.ts, 11, 12), Decl(typeFromPropertyAssignment36.ts, 14, 10))
}
// error d.q might not be assigned
d.q
>d.q : Symbol(d.q, Decl(typeFromPropertyAssignment36.ts, 6, 12), Decl(typeFromPropertyAssignment36.ts, 11, 12), Decl(typeFromPropertyAssignment36.ts, 14, 10))
>d : Symbol(d, Decl(typeFromPropertyAssignment36.ts, 0, 24))
>q : Symbol(d.q, Decl(typeFromPropertyAssignment36.ts, 6, 12), Decl(typeFromPropertyAssignment36.ts, 11, 12), Decl(typeFromPropertyAssignment36.ts, 14, 10))
if (b) {
>b : Symbol(b, Decl(typeFromPropertyAssignment36.ts, 0, 11))
d.q = false
>d.q : Symbol(d.q, Decl(typeFromPropertyAssignment36.ts, 6, 12), Decl(typeFromPropertyAssignment36.ts, 11, 12), Decl(typeFromPropertyAssignment36.ts, 14, 10))
>d : Symbol(d, Decl(typeFromPropertyAssignment36.ts, 0, 24))
>q : Symbol(d.q, Decl(typeFromPropertyAssignment36.ts, 6, 12), Decl(typeFromPropertyAssignment36.ts, 11, 12), Decl(typeFromPropertyAssignment36.ts, 14, 10))
}
else {
d.q = true
>d.q : Symbol(d.q, Decl(typeFromPropertyAssignment36.ts, 6, 12), Decl(typeFromPropertyAssignment36.ts, 11, 12), Decl(typeFromPropertyAssignment36.ts, 14, 10))
>d : Symbol(d, Decl(typeFromPropertyAssignment36.ts, 0, 24))
>q : Symbol(d.q, Decl(typeFromPropertyAssignment36.ts, 6, 12), Decl(typeFromPropertyAssignment36.ts, 11, 12), Decl(typeFromPropertyAssignment36.ts, 14, 10))
}
d.q
>d.q : Symbol(d.q, Decl(typeFromPropertyAssignment36.ts, 6, 12), Decl(typeFromPropertyAssignment36.ts, 11, 12), Decl(typeFromPropertyAssignment36.ts, 14, 10))
>d : Symbol(d, Decl(typeFromPropertyAssignment36.ts, 0, 24))
>q : Symbol(d.q, Decl(typeFromPropertyAssignment36.ts, 6, 12), Decl(typeFromPropertyAssignment36.ts, 11, 12), Decl(typeFromPropertyAssignment36.ts, 14, 10))
if (b) {
>b : Symbol(b, Decl(typeFromPropertyAssignment36.ts, 0, 11))
d.r = 1
>d.r : Symbol(d.r, Decl(typeFromPropertyAssignment36.ts, 18, 12), Decl(typeFromPropertyAssignment36.ts, 21, 10))
>d : Symbol(d, Decl(typeFromPropertyAssignment36.ts, 0, 24))
>r : Symbol(d.r, Decl(typeFromPropertyAssignment36.ts, 18, 12), Decl(typeFromPropertyAssignment36.ts, 21, 10))
}
else {
d.r = 2
>d.r : Symbol(d.r, Decl(typeFromPropertyAssignment36.ts, 18, 12), Decl(typeFromPropertyAssignment36.ts, 21, 10))
>d : Symbol(d, Decl(typeFromPropertyAssignment36.ts, 0, 24))
>r : Symbol(d.r, Decl(typeFromPropertyAssignment36.ts, 18, 12), Decl(typeFromPropertyAssignment36.ts, 21, 10))
}
d.r
>d.r : Symbol(d.r, Decl(typeFromPropertyAssignment36.ts, 18, 12), Decl(typeFromPropertyAssignment36.ts, 21, 10))
>d : Symbol(d, Decl(typeFromPropertyAssignment36.ts, 0, 24))
>r : Symbol(d.r, Decl(typeFromPropertyAssignment36.ts, 18, 12), Decl(typeFromPropertyAssignment36.ts, 21, 10))
if (b) {
>b : Symbol(b, Decl(typeFromPropertyAssignment36.ts, 0, 11))
d.s = 'hi'
>d.s : Symbol(d.s, Decl(typeFromPropertyAssignment36.ts, 25, 12))
>d : Symbol(d, Decl(typeFromPropertyAssignment36.ts, 0, 24))
>s : Symbol(d.s, Decl(typeFromPropertyAssignment36.ts, 25, 12))
}
return d
>d : Symbol(d, Decl(typeFromPropertyAssignment36.ts, 0, 24))
}
// OK to access possibly-unassigned properties outside the initialising scope
var test = f(true).s
>test : Symbol(test, Decl(typeFromPropertyAssignment36.ts, 31, 3))
>f(true).s : Symbol(d.s, Decl(typeFromPropertyAssignment36.ts, 25, 12))
>f : Symbol(f, Decl(typeFromPropertyAssignment36.ts, 0, 0))
>s : Symbol(d.s, Decl(typeFromPropertyAssignment36.ts, 25, 12))
function d() {
>d : Symbol(d, Decl(typeFromPropertyAssignment36.ts, 31, 20), Decl(typeFromPropertyAssignment36.ts, 34, 1))
}
d.e = 12
>d.e : Symbol(d.e, Decl(typeFromPropertyAssignment36.ts, 34, 1))
>d : Symbol(d, Decl(typeFromPropertyAssignment36.ts, 31, 20), Decl(typeFromPropertyAssignment36.ts, 34, 1))
>e : Symbol(d.e, Decl(typeFromPropertyAssignment36.ts, 34, 1))
d.e
>d.e : Symbol(d.e, Decl(typeFromPropertyAssignment36.ts, 34, 1))
>d : Symbol(d, Decl(typeFromPropertyAssignment36.ts, 31, 20), Decl(typeFromPropertyAssignment36.ts, 34, 1))
>e : Symbol(d.e, Decl(typeFromPropertyAssignment36.ts, 34, 1))
if (!!false) {
d.q = false
>d.q : Symbol(d.q, Decl(typeFromPropertyAssignment36.ts, 38, 14), Decl(typeFromPropertyAssignment36.ts, 42, 14), Decl(typeFromPropertyAssignment36.ts, 45, 6))
>d : Symbol(d, Decl(typeFromPropertyAssignment36.ts, 31, 20), Decl(typeFromPropertyAssignment36.ts, 34, 1))
>q : Symbol(d.q, Decl(typeFromPropertyAssignment36.ts, 38, 14), Decl(typeFromPropertyAssignment36.ts, 42, 14), Decl(typeFromPropertyAssignment36.ts, 45, 6))
}
d.q
>d.q : Symbol(d.q, Decl(typeFromPropertyAssignment36.ts, 38, 14), Decl(typeFromPropertyAssignment36.ts, 42, 14), Decl(typeFromPropertyAssignment36.ts, 45, 6))
>d : Symbol(d, Decl(typeFromPropertyAssignment36.ts, 31, 20), Decl(typeFromPropertyAssignment36.ts, 34, 1))
>q : Symbol(d.q, Decl(typeFromPropertyAssignment36.ts, 38, 14), Decl(typeFromPropertyAssignment36.ts, 42, 14), Decl(typeFromPropertyAssignment36.ts, 45, 6))
if (!!false) {
d.q = false
>d.q : Symbol(d.q, Decl(typeFromPropertyAssignment36.ts, 38, 14), Decl(typeFromPropertyAssignment36.ts, 42, 14), Decl(typeFromPropertyAssignment36.ts, 45, 6))
>d : Symbol(d, Decl(typeFromPropertyAssignment36.ts, 31, 20), Decl(typeFromPropertyAssignment36.ts, 34, 1))
>q : Symbol(d.q, Decl(typeFromPropertyAssignment36.ts, 38, 14), Decl(typeFromPropertyAssignment36.ts, 42, 14), Decl(typeFromPropertyAssignment36.ts, 45, 6))
}
else {
d.q = true
>d.q : Symbol(d.q, Decl(typeFromPropertyAssignment36.ts, 38, 14), Decl(typeFromPropertyAssignment36.ts, 42, 14), Decl(typeFromPropertyAssignment36.ts, 45, 6))
>d : Symbol(d, Decl(typeFromPropertyAssignment36.ts, 31, 20), Decl(typeFromPropertyAssignment36.ts, 34, 1))
>q : Symbol(d.q, Decl(typeFromPropertyAssignment36.ts, 38, 14), Decl(typeFromPropertyAssignment36.ts, 42, 14), Decl(typeFromPropertyAssignment36.ts, 45, 6))
}
d.q
>d.q : Symbol(d.q, Decl(typeFromPropertyAssignment36.ts, 38, 14), Decl(typeFromPropertyAssignment36.ts, 42, 14), Decl(typeFromPropertyAssignment36.ts, 45, 6))
>d : Symbol(d, Decl(typeFromPropertyAssignment36.ts, 31, 20), Decl(typeFromPropertyAssignment36.ts, 34, 1))
>q : Symbol(d.q, Decl(typeFromPropertyAssignment36.ts, 38, 14), Decl(typeFromPropertyAssignment36.ts, 42, 14), Decl(typeFromPropertyAssignment36.ts, 45, 6))
if (!!false) {
d.r = 1
>d.r : Symbol(d.r, Decl(typeFromPropertyAssignment36.ts, 49, 14), Decl(typeFromPropertyAssignment36.ts, 52, 6))
>d : Symbol(d, Decl(typeFromPropertyAssignment36.ts, 31, 20), Decl(typeFromPropertyAssignment36.ts, 34, 1))
>r : Symbol(d.r, Decl(typeFromPropertyAssignment36.ts, 49, 14), Decl(typeFromPropertyAssignment36.ts, 52, 6))
}
else {
d.r = 2
>d.r : Symbol(d.r, Decl(typeFromPropertyAssignment36.ts, 49, 14), Decl(typeFromPropertyAssignment36.ts, 52, 6))
>d : Symbol(d, Decl(typeFromPropertyAssignment36.ts, 31, 20), Decl(typeFromPropertyAssignment36.ts, 34, 1))
>r : Symbol(d.r, Decl(typeFromPropertyAssignment36.ts, 49, 14), Decl(typeFromPropertyAssignment36.ts, 52, 6))
}
d.r
>d.r : Symbol(d.r, Decl(typeFromPropertyAssignment36.ts, 49, 14), Decl(typeFromPropertyAssignment36.ts, 52, 6))
>d : Symbol(d, Decl(typeFromPropertyAssignment36.ts, 31, 20), Decl(typeFromPropertyAssignment36.ts, 34, 1))
>r : Symbol(d.r, Decl(typeFromPropertyAssignment36.ts, 49, 14), Decl(typeFromPropertyAssignment36.ts, 52, 6))
// test function expressions too
const g = function() {
>g : Symbol(g, Decl(typeFromPropertyAssignment36.ts, 58, 5))
}
if (!!false) {
g.expando = 1
>g.expando : Symbol(g.expando, Decl(typeFromPropertyAssignment36.ts, 60, 14))
>g : Symbol(g, Decl(typeFromPropertyAssignment36.ts, 58, 5))
>expando : Symbol(g.expando, Decl(typeFromPropertyAssignment36.ts, 60, 14))
}
g.expando // error
>g.expando : Symbol(g.expando, Decl(typeFromPropertyAssignment36.ts, 60, 14))
>g : Symbol(g, Decl(typeFromPropertyAssignment36.ts, 58, 5))
>expando : Symbol(g.expando, Decl(typeFromPropertyAssignment36.ts, 60, 14))
if (!!false) {
g.both = 'hi'
>g.both : Symbol(g.both, Decl(typeFromPropertyAssignment36.ts, 65, 14), Decl(typeFromPropertyAssignment36.ts, 68, 6))
>g : Symbol(g, Decl(typeFromPropertyAssignment36.ts, 58, 5))
>both : Symbol(g.both, Decl(typeFromPropertyAssignment36.ts, 65, 14), Decl(typeFromPropertyAssignment36.ts, 68, 6))
}
else {
g.both = 0
>g.both : Symbol(g.both, Decl(typeFromPropertyAssignment36.ts, 65, 14), Decl(typeFromPropertyAssignment36.ts, 68, 6))
>g : Symbol(g, Decl(typeFromPropertyAssignment36.ts, 58, 5))
>both : Symbol(g.both, Decl(typeFromPropertyAssignment36.ts, 65, 14), Decl(typeFromPropertyAssignment36.ts, 68, 6))
}
g.both
>g.both : Symbol(g.both, Decl(typeFromPropertyAssignment36.ts, 65, 14), Decl(typeFromPropertyAssignment36.ts, 68, 6))
>g : Symbol(g, Decl(typeFromPropertyAssignment36.ts, 58, 5))
>both : Symbol(g.both, Decl(typeFromPropertyAssignment36.ts, 65, 14), Decl(typeFromPropertyAssignment36.ts, 68, 6))

View File

@ -0,0 +1,233 @@
=== tests/cases/conformance/salsa/typeFromPropertyAssignment36.ts ===
function f(b: boolean) {
>f : (b: boolean) => { (): void; e: number; q: boolean; r: number; s: string; }
>b : boolean
function d() {
>d : { (): void; e: number; q: boolean; r: number; s: string; }
}
d.e = 12
>d.e = 12 : 12
>d.e : number
>d : { (): void; e: number; q: boolean; r: number; s: string; }
>e : number
>12 : 12
d.e
>d.e : number
>d : { (): void; e: number; q: boolean; r: number; s: string; }
>e : number
if (b) {
>b : boolean
d.q = false
>d.q = false : false
>d.q : boolean
>d : { (): void; e: number; q: boolean; r: number; s: string; }
>q : boolean
>false : false
}
// error d.q might not be assigned
d.q
>d.q : boolean
>d : { (): void; e: number; q: boolean; r: number; s: string; }
>q : boolean
if (b) {
>b : boolean
d.q = false
>d.q = false : false
>d.q : boolean
>d : { (): void; e: number; q: boolean; r: number; s: string; }
>q : boolean
>false : false
}
else {
d.q = true
>d.q = true : true
>d.q : boolean
>d : { (): void; e: number; q: boolean; r: number; s: string; }
>q : boolean
>true : true
}
d.q
>d.q : boolean
>d : { (): void; e: number; q: boolean; r: number; s: string; }
>q : boolean
if (b) {
>b : boolean
d.r = 1
>d.r = 1 : 1
>d.r : number
>d : { (): void; e: number; q: boolean; r: number; s: string; }
>r : number
>1 : 1
}
else {
d.r = 2
>d.r = 2 : 2
>d.r : number
>d : { (): void; e: number; q: boolean; r: number; s: string; }
>r : number
>2 : 2
}
d.r
>d.r : number
>d : { (): void; e: number; q: boolean; r: number; s: string; }
>r : number
if (b) {
>b : boolean
d.s = 'hi'
>d.s = 'hi' : "hi"
>d.s : string
>d : { (): void; e: number; q: boolean; r: number; s: string; }
>s : string
>'hi' : "hi"
}
return d
>d : { (): void; e: number; q: boolean; r: number; s: string; }
}
// OK to access possibly-unassigned properties outside the initialising scope
var test = f(true).s
>test : string
>f(true).s : string
>f(true) : { (): void; e: number; q: boolean; r: number; s: string; }
>f : (b: boolean) => { (): void; e: number; q: boolean; r: number; s: string; }
>true : true
>s : string
function d() {
>d : typeof d
}
d.e = 12
>d.e = 12 : 12
>d.e : number
>d : typeof d
>e : number
>12 : 12
d.e
>d.e : number
>d : typeof d
>e : number
if (!!false) {
>!!false : false
>!false : true
>false : false
d.q = false
>d.q = false : false
>d.q : boolean
>d : typeof d
>q : boolean
>false : false
}
d.q
>d.q : boolean
>d : typeof d
>q : boolean
if (!!false) {
>!!false : false
>!false : true
>false : false
d.q = false
>d.q = false : false
>d.q : boolean
>d : typeof d
>q : boolean
>false : false
}
else {
d.q = true
>d.q = true : true
>d.q : boolean
>d : typeof d
>q : boolean
>true : true
}
d.q
>d.q : boolean
>d : typeof d
>q : boolean
if (!!false) {
>!!false : false
>!false : true
>false : false
d.r = 1
>d.r = 1 : 1
>d.r : number
>d : typeof d
>r : number
>1 : 1
}
else {
d.r = 2
>d.r = 2 : 2
>d.r : number
>d : typeof d
>r : number
>2 : 2
}
d.r
>d.r : number
>d : typeof d
>r : number
// test function expressions too
const g = function() {
>g : { (): void; expando: number; both: string | number; }
>function() {} : { (): void; expando: number; both: string | number; }
}
if (!!false) {
>!!false : false
>!false : true
>false : false
g.expando = 1
>g.expando = 1 : 1
>g.expando : number
>g : { (): void; expando: number; both: string | number; }
>expando : number
>1 : 1
}
g.expando // error
>g.expando : number
>g : { (): void; expando: number; both: string | number; }
>expando : number
if (!!false) {
>!!false : false
>!false : true
>false : false
g.both = 'hi'
>g.both = 'hi' : "hi"
>g.both : string | number
>g : { (): void; expando: number; both: string | number; }
>both : string | number
>'hi' : "hi"
}
else {
g.both = 0
>g.both = 0 : 0
>g.both : string | number
>g : { (): void; expando: number; both: string | number; }
>both : string | number
>0 : 0
}
g.both
>g.both : string | number
>g : { (): void; expando: number; both: string | number; }
>both : string | number

View File

@ -0,0 +1,47 @@
tests/cases/conformance/salsa/a.js(28,24): error TS2339: Property 'addon' does not exist on type '{ set: () => void; get(): void; }'.
==== tests/cases/conformance/salsa/a.js (1 errors) ====
// non top-level:
// all references to _map, set, get, addon should be ok
(function container() {
/** @constructor */
var Multimap = function() {
this._map = {};
this._map
this.set
this.get
this.addon
};
Multimap.prototype = {
set: function() {
this._map
this.set
this.get
this.addon
},
get() {
this._map
this.set
this.get
this.addon
}
}
Multimap.prototype.addon = function () {
~~~~~
!!! error TS2339: Property 'addon' does not exist on type '{ set: () => void; get(): void; }'.
this._map
this.set
this.get
this.addon
}
var mm = new Multimap();
mm._map
mm.set
mm.get
mm.addon
});

View File

@ -0,0 +1,127 @@
=== tests/cases/conformance/salsa/a.js ===
// non top-level:
// all references to _map, set, get, addon should be ok
(function container() {
>container : Symbol(container, Decl(a.js, 2, 1))
/** @constructor */
var Multimap = function() {
>Multimap : Symbol(Multimap, Decl(a.js, 4, 7))
this._map = {};
>this._map : Symbol(Multimap._map, Decl(a.js, 4, 31))
>_map : Symbol(Multimap._map, Decl(a.js, 4, 31))
this._map
>this._map : Symbol(Multimap._map, Decl(a.js, 4, 31))
>_map : Symbol(Multimap._map, Decl(a.js, 4, 31))
this.set
>this.set : Symbol(set, Decl(a.js, 12, 26))
>set : Symbol(set, Decl(a.js, 12, 26))
this.get
>this.get : Symbol(get, Decl(a.js, 18, 10))
>get : Symbol(get, Decl(a.js, 18, 10))
this.addon
>this.addon : Symbol(Multimap.addon, Decl(a.js, 25, 5))
>addon : Symbol(Multimap.addon, Decl(a.js, 25, 5))
};
Multimap.prototype = {
>Multimap.prototype : Symbol(Multimap.prototype, Decl(a.js, 10, 6))
>Multimap : Symbol(Multimap, Decl(a.js, 4, 7))
>prototype : Symbol(Multimap.prototype, Decl(a.js, 10, 6))
set: function() {
>set : Symbol(set, Decl(a.js, 12, 26))
this._map
>this._map : Symbol(Multimap._map, Decl(a.js, 4, 31))
>_map : Symbol(Multimap._map, Decl(a.js, 4, 31))
this.set
>this.set : Symbol(set, Decl(a.js, 12, 26))
>set : Symbol(set, Decl(a.js, 12, 26))
this.get
>this.get : Symbol(get, Decl(a.js, 18, 10))
>get : Symbol(get, Decl(a.js, 18, 10))
this.addon
>this.addon : Symbol(Multimap.addon, Decl(a.js, 25, 5))
>addon : Symbol(Multimap.addon, Decl(a.js, 25, 5))
},
get() {
>get : Symbol(get, Decl(a.js, 18, 10))
this._map
>this._map : Symbol(Multimap._map, Decl(a.js, 4, 31))
>_map : Symbol(Multimap._map, Decl(a.js, 4, 31))
this.set
>this.set : Symbol(set, Decl(a.js, 12, 26))
>set : Symbol(set, Decl(a.js, 12, 26))
this.get
>this.get : Symbol(get, Decl(a.js, 18, 10))
>get : Symbol(get, Decl(a.js, 18, 10))
this.addon
>this.addon : Symbol(Multimap.addon, Decl(a.js, 25, 5))
>addon : Symbol(Multimap.addon, Decl(a.js, 25, 5))
}
}
Multimap.prototype.addon = function () {
>Multimap.prototype : Symbol(Multimap.addon, Decl(a.js, 25, 5))
>Multimap : Symbol(Multimap, Decl(a.js, 4, 7))
>prototype : Symbol(Multimap.prototype, Decl(a.js, 10, 6))
>addon : Symbol(Multimap.addon, Decl(a.js, 25, 5))
this._map
>this._map : Symbol(Multimap._map, Decl(a.js, 4, 31))
>_map : Symbol(Multimap._map, Decl(a.js, 4, 31))
this.set
>this.set : Symbol(set, Decl(a.js, 12, 26))
>set : Symbol(set, Decl(a.js, 12, 26))
this.get
>this.get : Symbol(get, Decl(a.js, 18, 10))
>get : Symbol(get, Decl(a.js, 18, 10))
this.addon
>this.addon : Symbol(Multimap.addon, Decl(a.js, 25, 5))
>addon : Symbol(Multimap.addon, Decl(a.js, 25, 5))
}
var mm = new Multimap();
>mm : Symbol(mm, Decl(a.js, 34, 7))
>Multimap : Symbol(Multimap, Decl(a.js, 4, 7))
mm._map
>mm._map : Symbol(Multimap._map, Decl(a.js, 4, 31))
>mm : Symbol(mm, Decl(a.js, 34, 7))
>_map : Symbol(Multimap._map, Decl(a.js, 4, 31))
mm.set
>mm.set : Symbol(set, Decl(a.js, 12, 26))
>mm : Symbol(mm, Decl(a.js, 34, 7))
>set : Symbol(set, Decl(a.js, 12, 26))
mm.get
>mm.get : Symbol(get, Decl(a.js, 18, 10))
>mm : Symbol(mm, Decl(a.js, 34, 7))
>get : Symbol(get, Decl(a.js, 18, 10))
mm.addon
>mm.addon : Symbol(Multimap.addon, Decl(a.js, 25, 5))
>mm : Symbol(mm, Decl(a.js, 34, 7))
>addon : Symbol(Multimap.addon, Decl(a.js, 25, 5))
});

View File

@ -0,0 +1,156 @@
=== tests/cases/conformance/salsa/a.js ===
// non top-level:
// all references to _map, set, get, addon should be ok
(function container() {
>(function container() { /** @constructor */ var Multimap = function() { this._map = {}; this._map this.set this.get this.addon }; Multimap.prototype = { set: function() { this._map this.set this.get this.addon }, get() { this._map this.set this.get this.addon } } Multimap.prototype.addon = function () { this._map this.set this.get this.addon } var mm = new Multimap(); mm._map mm.set mm.get mm.addon}) : () => void
>function container() { /** @constructor */ var Multimap = function() { this._map = {}; this._map this.set this.get this.addon }; Multimap.prototype = { set: function() { this._map this.set this.get this.addon }, get() { this._map this.set this.get this.addon } } Multimap.prototype.addon = function () { this._map this.set this.get this.addon } var mm = new Multimap(); mm._map mm.set mm.get mm.addon} : () => void
>container : () => void
/** @constructor */
var Multimap = function() {
>Multimap : typeof Multimap
>function() { this._map = {}; this._map this.set this.get this.addon } : typeof Multimap
this._map = {};
>this._map = {} : {}
>this._map : {}
>this : Multimap & { set: () => void; get(): void; }
>_map : {}
>{} : {}
this._map
>this._map : {}
>this : Multimap & { set: () => void; get(): void; }
>_map : {}
this.set
>this.set : () => void
>this : Multimap & { set: () => void; get(): void; }
>set : () => void
this.get
>this.get : () => void
>this : Multimap & { set: () => void; get(): void; }
>get : () => void
this.addon
>this.addon : () => void
>this : Multimap & { set: () => void; get(): void; }
>addon : () => void
};
Multimap.prototype = {
>Multimap.prototype = { set: function() { this._map this.set this.get this.addon }, get() { this._map this.set this.get this.addon } } : { set: () => void; get(): void; }
>Multimap.prototype : { set: () => void; get(): void; }
>Multimap : typeof Multimap
>prototype : { set: () => void; get(): void; }
>{ set: function() { this._map this.set this.get this.addon }, get() { this._map this.set this.get this.addon } } : { set: () => void; get(): void; }
set: function() {
>set : () => void
>function() { this._map this.set this.get this.addon } : () => void
this._map
>this._map : {}
>this : Multimap & { set: () => void; get(): void; }
>_map : {}
this.set
>this.set : () => void
>this : Multimap & { set: () => void; get(): void; }
>set : () => void
this.get
>this.get : () => void
>this : Multimap & { set: () => void; get(): void; }
>get : () => void
this.addon
>this.addon : () => void
>this : Multimap & { set: () => void; get(): void; }
>addon : () => void
},
get() {
>get : () => void
this._map
>this._map : {}
>this : Multimap & { set: () => void; get(): void; }
>_map : {}
this.set
>this.set : () => void
>this : Multimap & { set: () => void; get(): void; }
>set : () => void
this.get
>this.get : () => void
>this : Multimap & { set: () => void; get(): void; }
>get : () => void
this.addon
>this.addon : () => void
>this : Multimap & { set: () => void; get(): void; }
>addon : () => void
}
}
Multimap.prototype.addon = function () {
>Multimap.prototype.addon = function () { this._map this.set this.get this.addon } : () => void
>Multimap.prototype.addon : any
>Multimap.prototype : { set: () => void; get(): void; }
>Multimap : typeof Multimap
>prototype : { set: () => void; get(): void; }
>addon : any
>function () { this._map this.set this.get this.addon } : () => void
this._map
>this._map : {}
>this : Multimap & { set: () => void; get(): void; }
>_map : {}
this.set
>this.set : () => void
>this : Multimap & { set: () => void; get(): void; }
>set : () => void
this.get
>this.get : () => void
>this : Multimap & { set: () => void; get(): void; }
>get : () => void
this.addon
>this.addon : () => void
>this : Multimap & { set: () => void; get(): void; }
>addon : () => void
}
var mm = new Multimap();
>mm : Multimap & { set: () => void; get(): void; }
>new Multimap() : Multimap & { set: () => void; get(): void; }
>Multimap : typeof Multimap
mm._map
>mm._map : {}
>mm : Multimap & { set: () => void; get(): void; }
>_map : {}
mm.set
>mm.set : () => void
>mm : Multimap & { set: () => void; get(): void; }
>set : () => void
mm.get
>mm.get : () => void
>mm : Multimap & { set: () => void; get(): void; }
>get : () => void
mm.addon
>mm.addon : () => void
>mm : Multimap & { set: () => void; get(): void; }
>addon : () => void
});

View File

@ -92,8 +92,6 @@ node_modules/async/dist/async.js(31,29): error TS1003: Identifier expected.
node_modules/async/dist/async.js(31,30): error TS1003: Identifier expected.
node_modules/async/dist/async.js(257,56): error TS2339: Property 'Object' does not exist on type 'Window'.
node_modules/async/dist/async.js(298,7): error TS2454: Variable 'unmasked' is used before being assigned.
node_modules/async/dist/async.js(480,35): error TS2538: Type 'true' cannot be used as an index type.
node_modules/async/dist/async.js(480,59): error TS2538: Type 'true' cannot be used as an index type.
node_modules/async/dist/async.js(622,80): error TS2339: Property 'nodeType' does not exist on type 'NodeModule'.
node_modules/async/dist/async.js(748,84): error TS2339: Property 'nodeType' does not exist on type 'NodeModule'.
node_modules/async/dist/async.js(754,49): error TS2339: Property 'process' does not exist on type 'false | Global'.
@ -523,8 +521,6 @@ node_modules/async/internal/filter.js(64,29): error TS2695: Left side of comma o
node_modules/async/internal/filter.js(66,18): error TS2695: Left side of comma operator is unused and has no side effects.
node_modules/async/internal/filter.js(72,19): error TS2695: Left side of comma operator is unused and has no side effects.
node_modules/async/internal/filter.js(73,27): error TS2695: Left side of comma operator is unused and has no side effects.
node_modules/async/internal/getIterator.js(8,35): error TS2538: Type 'true' cannot be used as an index type.
node_modules/async/internal/getIterator.js(8,59): error TS2538: Type 'true' cannot be used as an index type.
node_modules/async/internal/initialParams.js(9,21): error TS2695: Left side of comma operator is unused and has no side effects.
node_modules/async/internal/iterator.js(41,18): error TS2695: Left side of comma operator is unused and has no side effects.
node_modules/async/internal/iterator.js(51,10): error TS2695: Left side of comma operator is unused and has no side effects.

View File

@ -29,10 +29,8 @@ node_modules/chrome-devtools-frontend/front_end/Runtime.js(270,9): error TS2322:
Type 'void' is not assignable to type 'undefined'.
node_modules/chrome-devtools-frontend/front_end/Runtime.js(280,5): error TS2322: Type 'Promise<void>' is not assignable to type 'Promise<undefined>'.
node_modules/chrome-devtools-frontend/front_end/Runtime.js(283,7): error TS2554: Expected 2-3 arguments, but got 1.
node_modules/chrome-devtools-frontend/front_end/Runtime.js(527,9): error TS2322: Type 'Function' is not assignable to type 'new () => any'.
Type 'Function' provides no match for the signature 'new (): any'.
node_modules/chrome-devtools-frontend/front_end/Runtime.js(527,49): error TS2352: Conversion of type 'Window' to type 'Function' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
Property 'apply' is missing in type 'Window'.
node_modules/chrome-devtools-frontend/front_end/Runtime.js(527,49): error TS2352: Conversion of type 'Window' to type 'new () => any' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
Type 'Window' provides no match for the signature 'new (): any'.
node_modules/chrome-devtools-frontend/front_end/Runtime.js(539,20): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
node_modules/chrome-devtools-frontend/front_end/Runtime.js(693,7): error TS2322: Type 'Promise<boolean>' is not assignable to type 'Promise<undefined>'.
Type 'boolean' is not assignable to type 'undefined'.
@ -142,7 +140,6 @@ node_modules/chrome-devtools-frontend/front_end/accessibility/AXBreadcrumbsPane.
node_modules/chrome-devtools-frontend/front_end/accessibility/AXBreadcrumbsPane.js(274,42): error TS2554: Expected 2 arguments, but got 1.
node_modules/chrome-devtools-frontend/front_end/accessibility/AXBreadcrumbsPane.js(298,19): error TS2339: Property 'breadcrumb' does not exist on type 'Element'.
node_modules/chrome-devtools-frontend/front_end/accessibility/AXBreadcrumbsPane.js(302,23): error TS2339: Property 'tabIndex' does not exist on type 'Element'.
node_modules/chrome-devtools-frontend/front_end/accessibility/AXBreadcrumbsPane.js(314,15): error TS1110: Type expected.
node_modules/chrome-devtools-frontend/front_end/accessibility/AXBreadcrumbsPane.js(323,23): error TS2339: Property 'style' does not exist on type 'Element'.
node_modules/chrome-devtools-frontend/front_end/accessibility/AXBreadcrumbsPane.js(330,27): error TS2339: Property 'createChild' does not exist on type 'Element'.
node_modules/chrome-devtools-frontend/front_end/accessibility/AXBreadcrumbsPane.js(391,50): error TS2345: Argument of type '0' is not assignable to parameter of type 'string'.
@ -284,7 +281,7 @@ node_modules/chrome-devtools-frontend/front_end/animation/AnimationModel.js(811,
node_modules/chrome-devtools-frontend/front_end/animation/AnimationModel.js(811,44): error TS2300: Duplicate identifier 'Request'.
node_modules/chrome-devtools-frontend/front_end/animation/AnimationScreenshotPopover.js(7,11): error TS2339: Property 'AnimationScreenshotPopover' does not exist on type '{ new (effect?: AnimationEffect, timeline?: AnimationTimeline): Animation; prototype: Animation; }'.
node_modules/chrome-devtools-frontend/front_end/animation/AnimationScreenshotPopover.js(9,23): error TS2304: Cannot find name 'Image'.
node_modules/chrome-devtools-frontend/front_end/animation/AnimationScreenshotPopover.js(18,39): error TS2322: Type 'new (width?: number, height?: number) => HTMLImageElement' is not assignable to type 'Node'.
node_modules/chrome-devtools-frontend/front_end/animation/AnimationScreenshotPopover.js(18,39): error TS2345: Argument of type 'new (width?: number, height?: number) => HTMLImageElement' is not assignable to parameter of type 'Node'.
Property 'baseURI' is missing in type 'new (width?: number, height?: number) => HTMLImageElement'.
node_modules/chrome-devtools-frontend/front_end/animation/AnimationScreenshotPopover.js(19,13): error TS2339: Property 'style' does not exist on type 'new (width?: number, height?: number) => HTMLImageElement'.
node_modules/chrome-devtools-frontend/front_end/animation/AnimationScreenshotPopover.js(22,21): error TS2339: Property 'style' does not exist on type 'new (width?: number, height?: number) => HTMLImageElement'.
@ -1289,8 +1286,19 @@ node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighth
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(44348,15): error TS2339: Property 'keysArray' does not exist on type 'Map<any, any>'.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(44356,15): error TS2339: Property 'inverse' does not exist on type 'Map<any, any>'.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(44361,8): error TS2339: Property 'set' does not exist on type 'Multimap'.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(44439,17): error TS2339: Property 'get' does not exist on type 'Multimap'.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(44458,18): error TS2339: Property 'keysArray' does not exist on type 'Map<any, any>'.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(44467,15): error TS2339: Property 'keysArray' does not exist on type 'Multimap'.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(44469,8): error TS2339: Property 'pushAll' does not exist on type 'any[]'.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(44469,21): error TS2339: Property 'get' does not exist on type 'Multimap'.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(44495,27): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(44525,22): error TS2339: Property '_outgoingCallback' does not exist on type 'CallbackBarrier'.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(44527,13): error TS2339: Property '_incomingCallback' does not exist on type 'CallbackBarrier'.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(44535,22): error TS2339: Property '_outgoingCallback' does not exist on type 'CallbackBarrier'.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(44536,6): error TS2339: Property '_outgoingCallback' does not exist on type 'CallbackBarrier'.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(44538,6): error TS2339: Property '_outgoingCallback' does not exist on type 'CallbackBarrier'.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(44568,50): error TS2339: Property '_outgoingCallback' does not exist on type 'CallbackBarrier'.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(44569,6): error TS2339: Property '_outgoingCallback' does not exist on type 'CallbackBarrier'.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(44584,6): error TS2339: Property 'setImmediate' does not exist on type 'Window'.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(44595,19): error TS2339: Property 'spread' does not exist on type 'Promise<any>'.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(44610,19): error TS2339: Property 'catchException' does not exist on type 'Promise<any>'.
@ -3010,6 +3018,7 @@ node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighth
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(67117,1): error TS2322: Type 'string[]' is not assignable to type 'RegExpExecArray'.
Property 'index' is missing in type 'string[]'.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(67167,19): error TS2339: Property 'parse' does not exist on type 'Link'.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(67225,13): error TS2339: Property 'get' does not exist on type 'Link'.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(67300,14): error TS2339: Property 'Channels' does not exist on type '{}'.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(67300,35): error TS2339: Property 'Channels' does not exist on type '{}'.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(67301,24): error TS2339: Property 'Channels' does not exist on type '{}'.
@ -3310,6 +3319,8 @@ node_modules/chrome-devtools-frontend/front_end/cm/codemirror.js(2858,32): error
node_modules/chrome-devtools-frontend/front_end/cm/codemirror.js(2858,49): error TS2339: Property 'right' does not exist on type 'never'.
node_modules/chrome-devtools-frontend/front_end/cm/codemirror.js(3034,25): error TS2339: Property 'xRel' does not exist on type 'Pos'.
node_modules/chrome-devtools-frontend/front_end/cm/codemirror.js(4840,5): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.
node_modules/chrome-devtools-frontend/front_end/cm/codemirror.js(5583,12): error TS2339: Property 'collapse' does not exist on type 'BranchChunk'.
node_modules/chrome-devtools-frontend/front_end/cm/codemirror.js(5615,18): error TS2339: Property 'maybeSpill' does not exist on type 'BranchChunk'.
node_modules/chrome-devtools-frontend/front_end/cm/codemirror.js(5675,35): error TS2339: Property 'line' does not exist on type 'LineWidget'.
node_modules/chrome-devtools-frontend/front_end/cm/codemirror.js(5675,61): error TS2339: Property 'line' does not exist on type 'LineWidget'.
node_modules/chrome-devtools-frontend/front_end/cm/codemirror.js(5693,57): error TS2339: Property 'line' does not exist on type 'LineWidget'.
@ -3419,6 +3430,7 @@ node_modules/chrome-devtools-frontend/front_end/cm/overlay.js(16,19): error TS23
node_modules/chrome-devtools-frontend/front_end/cm/overlay.js(16,43): error TS2304: Cannot find name 'define'.
node_modules/chrome-devtools-frontend/front_end/cm/overlay.js(17,5): error TS2304: Cannot find name 'define'.
node_modules/chrome-devtools-frontend/front_end/cm_headless/headlesscodemirror.js(30,14): error TS2403: Subsequent variable declarations must have the same type. Variable 'ok' must be of type 'boolean', but here has type 'any'.
node_modules/chrome-devtools-frontend/front_end/cm_headless/headlesscodemirror.js(35,17): error TS2339: Property 'eat' does not exist on type 'StringStream'.
node_modules/chrome-devtools-frontend/front_end/cm_headless/headlesscodemirror.js(74,1): error TS2719: Type 'typeof StringStream' is not assignable to type 'typeof StringStream'. Two different types with this name exist, but they are unrelated.
Type 'StringStream' is not assignable to type 'StringStream & { backUp: (n: any) => void; column: () => void; current: () => void; eat: (match: any) => void; eatSpace: () => void; eatWhile: (match: any) => void; eol: () => void; indentation: () => void; ... 5 more ...; sol: () => void; }'.
Type 'StringStream' is not assignable to type '{ backUp: (n: any) => void; column: () => void; current: () => void; eat: (match: any) => void; eatSpace: () => void; eatWhile: (match: any) => void; eol: () => void; indentation: () => void; match: (pattern: string | RegExp, consume?: boolean, caseInsensitive?: boolean) => void; ... 4 more ...; sol: () => void; }'.
@ -4400,7 +4412,6 @@ node_modules/chrome-devtools-frontend/front_end/coverage/CoverageDecorationManag
node_modules/chrome-devtools-frontend/front_end/coverage/CoverageDecorationManager.js(247,24): error TS2694: Namespace 'Coverage' has no exported member 'RawLocation'.
node_modules/chrome-devtools-frontend/front_end/coverage/CoverageDecorationManager.js(248,24): error TS2694: Namespace 'Coverage' has no exported member 'RawLocation'.
node_modules/chrome-devtools-frontend/front_end/coverage/CoverageDecorationManager.js(255,22): error TS2694: Namespace 'Common' has no exported member 'Event'.
node_modules/chrome-devtools-frontend/front_end/coverage/CoverageDecorationManager.js(258,34): error TS1110: Type expected.
node_modules/chrome-devtools-frontend/front_end/coverage/CoverageDecorationManager.js(277,18): error TS2339: Property 'uninstallGutter' does not exist on type 'CodeMirrorTextEditor'.
node_modules/chrome-devtools-frontend/front_end/coverage/CoverageDecorationManager.js(293,16): error TS2339: Property 'uninstallGutter' does not exist on type 'CodeMirrorTextEditor'.
node_modules/chrome-devtools-frontend/front_end/coverage/CoverageDecorationManager.js(294,16): error TS2339: Property 'installGutter' does not exist on type 'CodeMirrorTextEditor'.
@ -4465,7 +4476,6 @@ node_modules/chrome-devtools-frontend/front_end/coverage/CoverageView.js(57,54):
node_modules/chrome-devtools-frontend/front_end/coverage/CoverageView.js(141,5): error TS2322: Type 'Timer' is not assignable to type 'number'.
node_modules/chrome-devtools-frontend/front_end/coverage/CoverageView.js(187,55): error TS2339: Property 'bytesToString' does not exist on type 'NumberConstructor'.
node_modules/chrome-devtools-frontend/front_end/coverage/CoverageView.js(187,85): error TS2339: Property 'bytesToString' does not exist on type 'NumberConstructor'.
node_modules/chrome-devtools-frontend/front_end/coverage/CoverageView.js(231,59): error TS1110: Type expected.
node_modules/chrome-devtools-frontend/front_end/coverage_test_runner/CoverageTestRunner.js(12,27): error TS2339: Property 'runtime' does not exist on type 'Window'.
node_modules/chrome-devtools-frontend/front_end/coverage_test_runner/CoverageTestRunner.js(20,27): error TS2339: Property 'runtime' does not exist on type 'Window'.
node_modules/chrome-devtools-frontend/front_end/coverage_test_runner/CoverageTestRunner.js(28,27): error TS2339: Property 'runtime' does not exist on type 'Window'.
@ -5867,6 +5877,8 @@ node_modules/chrome-devtools-frontend/front_end/emulation/DeviceModeToolbar.js(3
node_modules/chrome-devtools-frontend/front_end/emulation/DeviceModeToolbar.js(302,71): error TS2555: Expected at least 2 arguments, but got 1.
node_modules/chrome-devtools-frontend/front_end/emulation/DeviceModeToolbar.js(303,9): error TS2555: Expected at least 2 arguments, but got 1.
node_modules/chrome-devtools-frontend/front_end/emulation/DeviceModeToolbar.js(305,44): error TS2555: Expected at least 2 arguments, but got 1.
node_modules/chrome-devtools-frontend/front_end/emulation/DeviceModeToolbar.js(338,5): error TS2322: Type 'ToolbarItem' is not assignable to type '{ item(): any & any; } & { item(): any & any; }'.
Type 'ToolbarItem' is not assignable to type '{ item(): any & any; }'.
node_modules/chrome-devtools-frontend/front_end/emulation/DeviceModeToolbar.js(338,5): error TS2322: Type 'ToolbarItem' is not assignable to type '{ item(): any & any; } & { item(): any & any; }'.
Type 'ToolbarItem' is not assignable to type '{ item(): any & any; }'.
Property 'item' is missing in type 'ToolbarItem'.
@ -5899,8 +5911,6 @@ node_modules/chrome-devtools-frontend/front_end/emulation/DeviceModeView.js(83,9
node_modules/chrome-devtools-frontend/front_end/emulation/DeviceModeView.js(84,7): error TS2555: Expected at least 2 arguments, but got 1.
node_modules/chrome-devtools-frontend/front_end/emulation/DeviceModeView.js(84,34): error TS2555: Expected at least 2 arguments, but got 1.
node_modules/chrome-devtools-frontend/front_end/emulation/DeviceModeView.js(84,63): error TS2555: Expected at least 2 arguments, but got 1.
node_modules/chrome-devtools-frontend/front_end/emulation/DeviceModeView.js(103,12): error TS2339: Property '_model' does not exist on type 'typeof DeviceModeView'.
node_modules/chrome-devtools-frontend/front_end/emulation/DeviceModeView.js(104,12): error TS2339: Property '_model' does not exist on type 'typeof DeviceModeView'.
node_modules/chrome-devtools-frontend/front_end/emulation/DeviceModeView.js(105,9): error TS2339: Property 'consume' does not exist on type 'Event'.
node_modules/chrome-devtools-frontend/front_end/emulation/DeviceModeView.js(132,22): error TS2694: Namespace 'Common' has no exported member 'Event'.
node_modules/chrome-devtools-frontend/front_end/emulation/DeviceModeView.js(143,22): error TS2694: Namespace 'Common' has no exported member 'Event'.
@ -5925,18 +5935,8 @@ node_modules/chrome-devtools-frontend/front_end/emulation/DeviceModeView.js(483,
node_modules/chrome-devtools-frontend/front_end/emulation/DeviceModeView.js(500,22): error TS2339: Property 'createChild' does not exist on type 'Element'.
node_modules/chrome-devtools-frontend/front_end/emulation/DeviceModeWrapper.js(18,22): error TS2339: Property 'singleton' does not exist on type 'Window'.
node_modules/chrome-devtools-frontend/front_end/emulation/DeviceModeWrapper.js(33,24): error TS2694: Namespace 'Protocol' has no exported member 'Page'.
node_modules/chrome-devtools-frontend/front_end/emulation/DeviceModeWrapper.js(38,30): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
node_modules/chrome-devtools-frontend/front_end/emulation/DeviceModeWrapper.js(39,26): error TS2339: Property 'setNonEmulatedAvailableSize' does not exist on type 'typeof DeviceModeView'.
node_modules/chrome-devtools-frontend/front_end/emulation/DeviceModeWrapper.js(41,28): error TS2339: Property 'captureFullSizeScreenshot' does not exist on type 'typeof DeviceModeView'.
node_modules/chrome-devtools-frontend/front_end/emulation/DeviceModeWrapper.js(43,28): error TS2339: Property 'captureAreaScreenshot' does not exist on type 'typeof DeviceModeView'.
node_modules/chrome-devtools-frontend/front_end/emulation/DeviceModeWrapper.js(45,28): error TS2339: Property 'captureScreenshot' does not exist on type 'typeof DeviceModeView'.
node_modules/chrome-devtools-frontend/front_end/emulation/DeviceModeWrapper.js(50,22): error TS2694: Namespace 'Common' has no exported member 'Event'.
node_modules/chrome-devtools-frontend/front_end/emulation/DeviceModeWrapper.js(53,37): error TS2694: Namespace 'Protocol' has no exported member 'Page'.
node_modules/chrome-devtools-frontend/front_end/emulation/DeviceModeWrapper.js(63,66): error TS2339: Property 'isShowing' does not exist on type 'typeof DeviceModeView'.
node_modules/chrome-devtools-frontend/front_end/emulation/DeviceModeWrapper.js(70,32): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
node_modules/chrome-devtools-frontend/front_end/emulation/DeviceModeWrapper.js(71,28): error TS2339: Property 'show' does not exist on type 'typeof DeviceModeView'.
node_modules/chrome-devtools-frontend/front_end/emulation/DeviceModeWrapper.js(73,64): error TS2339: Property 'element' does not exist on type 'typeof DeviceModeView'.
node_modules/chrome-devtools-frontend/front_end/emulation/DeviceModeWrapper.js(76,30): error TS2339: Property 'detach' does not exist on type 'typeof DeviceModeView'.
node_modules/chrome-devtools-frontend/front_end/emulation/DeviceModeWrapper.js(120,45): error TS2694: Namespace 'Protocol' has no exported member 'Page'.
node_modules/chrome-devtools-frontend/front_end/emulation/DevicesSettingsTab.js(15,31): error TS2339: Property 'createChild' does not exist on type 'Element'.
node_modules/chrome-devtools-frontend/front_end/emulation/DevicesSettingsTab.js(16,46): error TS2555: Expected at least 2 arguments, but got 1.
@ -6096,8 +6096,10 @@ node_modules/chrome-devtools-frontend/front_end/event_listeners/EventListenersVi
node_modules/chrome-devtools-frontend/front_end/event_listeners/EventListenersView.js(321,13): error TS2339: Property 'consume' does not exist on type 'Event'.
node_modules/chrome-devtools-frontend/front_end/extensions/ExtensionAPI.js(130,25): error TS2339: Property 'sendRequest' does not exist on type 'ExtensionServerClient'.
node_modules/chrome-devtools-frontend/front_end/extensions/ExtensionAPI.js(132,23): error TS2339: Property 'registerHandler' does not exist on type 'ExtensionServerClient'.
node_modules/chrome-devtools-frontend/front_end/extensions/ExtensionAPI.js(132,68): error TS2339: Property '_dispatch' does not exist on type 'EventSinkImpl'.
node_modules/chrome-devtools-frontend/front_end/extensions/ExtensionAPI.js(145,25): error TS2339: Property 'sendRequest' does not exist on type 'ExtensionServerClient'.
node_modules/chrome-devtools-frontend/front_end/extensions/ExtensionAPI.js(149,19): error TS1110: Type expected.
node_modules/chrome-devtools-frontend/front_end/extensions/ExtensionAPI.js(161,14): error TS2339: Property '_fire' does not exist on type 'EventSinkImpl'.
node_modules/chrome-devtools-frontend/front_end/extensions/ExtensionAPI.js(186,12): error TS2339: Property '_fire' does not exist on type 'EventSinkImpl'.
node_modules/chrome-devtools-frontend/front_end/extensions/ExtensionAPI.js(203,23): error TS2339: Property 'sendRequest' does not exist on type 'ExtensionServerClient'.
node_modules/chrome-devtools-frontend/front_end/extensions/ExtensionAPI.js(207,23): error TS2339: Property 'sendRequest' does not exist on type 'ExtensionServerClient'.
@ -6120,7 +6122,9 @@ node_modules/chrome-devtools-frontend/front_end/extensions/ExtensionAPI.js(371,1
node_modules/chrome-devtools-frontend/front_end/extensions/ExtensionAPI.js(381,12): error TS8022: JSDoc '@extends' is not attached to a class.
node_modules/chrome-devtools-frontend/front_end/extensions/ExtensionAPI.js(391,12): error TS8022: JSDoc '@extends' is not attached to a class.
node_modules/chrome-devtools-frontend/front_end/extensions/ExtensionAPI.js(401,44): error TS2339: Property 'nextObjectId' does not exist on type 'ExtensionServerClient'.
node_modules/chrome-devtools-frontend/front_end/extensions/ExtensionAPI.js(404,21): error TS2339: Property '_id' does not exist on type 'ExtensionPanelImpl'.
node_modules/chrome-devtools-frontend/front_end/extensions/ExtensionAPI.js(410,23): error TS2339: Property 'sendRequest' does not exist on type 'ExtensionServerClient'.
node_modules/chrome-devtools-frontend/front_end/extensions/ExtensionAPI.js(418,60): error TS2339: Property '_id' does not exist on type 'ExtensionPanelImpl'.
node_modules/chrome-devtools-frontend/front_end/extensions/ExtensionAPI.js(419,23): error TS2339: Property 'sendRequest' does not exist on type 'ExtensionServerClient'.
node_modules/chrome-devtools-frontend/front_end/extensions/ExtensionAPI.js(429,12): error TS8022: JSDoc '@extends' is not attached to a class.
node_modules/chrome-devtools-frontend/front_end/extensions/ExtensionAPI.js(435,23): error TS2339: Property 'sendRequest' does not exist on type 'ExtensionServerClient'.
@ -6143,6 +6147,7 @@ node_modules/chrome-devtools-frontend/front_end/extensions/ExtensionAPI.js(662,2
node_modules/chrome-devtools-frontend/front_end/extensions/ExtensionAPI.js(678,10): error TS2339: Property 'registerHandler' does not exist on type 'ExtensionServerClient'.
node_modules/chrome-devtools-frontend/front_end/extensions/ExtensionAPI.js(678,43): error TS2551: Property '_onCallback' does not exist on type 'ExtensionServerClient'. Did you mean '_callbacks'?
node_modules/chrome-devtools-frontend/front_end/extensions/ExtensionAPI.js(682,49): error TS2339: Property '_onMessage' does not exist on type 'ExtensionServerClient'.
node_modules/chrome-devtools-frontend/front_end/extensions/ExtensionAPI.js(695,34): error TS2339: Property '_registerCallback' does not exist on type 'ExtensionServerClient'.
node_modules/chrome-devtools-frontend/front_end/extensions/ExtensionAPI.js(789,21): error TS2339: Property 'exposeWebInspectorNamespace' does not exist on type 'ExtensionDescriptor'.
node_modules/chrome-devtools-frontend/front_end/extensions/ExtensionAPI.js(790,12): error TS2339: Property 'webInspector' does not exist on type 'Window'.
node_modules/chrome-devtools-frontend/front_end/extensions/ExtensionPanel.js(232,23): error TS2339: Property 'style' does not exist on type 'Element'.
@ -6318,14 +6323,11 @@ node_modules/chrome-devtools-frontend/front_end/formatter_worker/ESTreeWalker.js
Property 'start' is missing in type 'TemplateLiteralNode'.
node_modules/chrome-devtools-frontend/front_end/formatter_worker/ESTreeWalker.js(63,57): error TS2345: Argument of type 'TemplateLiteralNode' is not assignable to parameter of type 'Node'.
node_modules/chrome-devtools-frontend/front_end/formatter_worker/ESTreeWalker.js(65,66): error TS2345: Argument of type 'TemplateLiteralNode' is not assignable to parameter of type 'Node'.
node_modules/chrome-devtools-frontend/front_end/formatter_worker/ESTreeWalker.js(89,53): error TS2300: Duplicate identifier 'SkipSubtree'.
node_modules/chrome-devtools-frontend/front_end/formatter_worker/ESTreeWalker.js(90,30): error TS2300: Duplicate identifier 'SkipSubtree'.
node_modules/chrome-devtools-frontend/front_end/formatter_worker/FormattedContentBuilder.js(47,39): error TS2339: Property 'peekLast' does not exist on type 'any[]'.
node_modules/chrome-devtools-frontend/front_end/formatter_worker/FormatterWorker.js(43,13): error TS1345: An expression of type 'void' cannot be tested for truthiness
node_modules/chrome-devtools-frontend/front_end/formatter_worker/FormatterWorker.js(44,24): error TS2339: Property 'token' does not exist on type 'void'.
node_modules/chrome-devtools-frontend/front_end/formatter_worker/FormatterWorker.js(46,20): error TS2345: Argument of type 'void' is not assignable to parameter of type 'string'.
node_modules/chrome-devtools-frontend/front_end/formatter_worker/FormatterWorker.js(46,69): error TS2339: Property 'length' does not exist on type 'void'.
node_modules/chrome-devtools-frontend/front_end/formatter_worker/FormatterWorker.js(58,26): error TS1110: Type expected.
node_modules/chrome-devtools-frontend/front_end/formatter_worker/FormatterWorker.js(96,3): error TS2554: Expected 2-3 arguments, but got 1.
node_modules/chrome-devtools-frontend/front_end/formatter_worker/FormatterWorker.js(103,45): error TS2322: Type 'number' is not assignable to type 'boolean'.
node_modules/chrome-devtools-frontend/front_end/formatter_worker/FormatterWorker.js(138,3): error TS2554: Expected 2-3 arguments, but got 1.
@ -8000,12 +8002,14 @@ node_modules/chrome-devtools-frontend/front_end/perf_ui/FlameChart.js(694,31): e
node_modules/chrome-devtools-frontend/front_end/perf_ui/FlameChart.js(701,13): error TS2403: Subsequent variable declarations must have the same type. Variable 'entryIndex' must be of type 'any', but here has type 'number'.
node_modules/chrome-devtools-frontend/front_end/perf_ui/FlameChart.js(796,43): error TS2339: Property 'peekLast' does not exist on type 'any[]'.
node_modules/chrome-devtools-frontend/front_end/perf_ui/FlameChart.js(903,60): error TS2694: Namespace 'PerfUI.FlameChart' has no exported member 'Group'.
node_modules/chrome-devtools-frontend/front_end/perf_ui/FlameChart.js(907,17): error TS1110: Type expected.
node_modules/chrome-devtools-frontend/front_end/perf_ui/FlameChart.js(915,27): error TS2339: Property 'peekLast' does not exist on type '{ nestingLevel: number; visible: boolean; }[]'.
node_modules/chrome-devtools-frontend/front_end/perf_ui/FlameChart.js(919,45): error TS2339: Property 'peekLast' does not exist on type '{ nestingLevel: number; visible: boolean; }[]'.
node_modules/chrome-devtools-frontend/front_end/perf_ui/FlameChart.js(931,33): error TS2694: Namespace 'PerfUI.FlameChart' has no exported member 'Group'.
node_modules/chrome-devtools-frontend/front_end/perf_ui/FlameChart.js(940,33): error TS2694: Namespace 'PerfUI.FlameChart' has no exported member 'Group'.
node_modules/chrome-devtools-frontend/front_end/perf_ui/FlameChart.js(1027,38): error TS2339: Property 'lowerBound' does not exist on type 'any[]'.
node_modules/chrome-devtools-frontend/front_end/perf_ui/FlameChart.js(1167,15): error TS1110: Type expected.
node_modules/chrome-devtools-frontend/front_end/perf_ui/FlameChart.js(1169,70): error TS2339: Property 'peekLast' does not exist on type 'any[]'.
node_modules/chrome-devtools-frontend/front_end/perf_ui/FlameChart.js(1176,27): error TS2339: Property 'peekLast' does not exist on type '{ nestingLevel: number; visible: boolean; }[]'.
node_modules/chrome-devtools-frontend/front_end/perf_ui/FlameChart.js(1182,43): error TS2339: Property 'peekLast' does not exist on type '{ nestingLevel: number; visible: boolean; }[]'.
node_modules/chrome-devtools-frontend/front_end/perf_ui/FlameChart.js(1273,25): error TS2339: Property 'style' does not exist on type 'Element'.
node_modules/chrome-devtools-frontend/front_end/perf_ui/FlameChart.js(1286,19): error TS2339: Property 'constrain' does not exist on type 'NumberConstructor'.
node_modules/chrome-devtools-frontend/front_end/perf_ui/FlameChart.js(1390,34): error TS2694: Namespace 'PerfUI.FlameChart' has no exported member 'GroupStyle'.
@ -8322,6 +8326,11 @@ node_modules/chrome-devtools-frontend/front_end/platform/utilities.js(1164,15):
node_modules/chrome-devtools-frontend/front_end/platform/utilities.js(1169,24): error TS2304: Cannot find name 'KEY'.
node_modules/chrome-devtools-frontend/front_end/platform/utilities.js(1169,30): error TS2304: Cannot find name 'VALUE'.
node_modules/chrome-devtools-frontend/front_end/platform/utilities.js(1171,15): error TS2339: Property 'inverse' does not exist on type 'Map<any, any>'.
node_modules/chrome-devtools-frontend/front_end/platform/utilities.js(1200,13): error TS2345: Argument of type 'V' is not assignable to parameter of type 'V'.
node_modules/chrome-devtools-frontend/front_end/platform/utilities.js(1211,5): error TS2719: Type 'Set<V>' is not assignable to type 'Set<V>'. Two different types with this name exist, but they are unrelated.
Type 'V' is not assignable to type 'V'. Two different types with this name exist, but they are unrelated.
node_modules/chrome-devtools-frontend/front_end/platform/utilities.js(1231,20): error TS2345: Argument of type 'V' is not assignable to parameter of type 'V'.
node_modules/chrome-devtools-frontend/front_end/platform/utilities.js(1267,22): error TS2339: Property 'keysArray' does not exist on type 'Map<K, Set<V>>'.
node_modules/chrome-devtools-frontend/front_end/platform/utilities.js(1277,14): error TS2339: Property 'pushAll' does not exist on type 'any[]'.
node_modules/chrome-devtools-frontend/front_end/platform/utilities.js(1277,40): error TS2339: Property 'valuesArray' does not exist on type 'Set<V>'.
node_modules/chrome-devtools-frontend/front_end/platform/utilities.js(1299,35): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'.
@ -12007,7 +12016,7 @@ node_modules/chrome-devtools-frontend/front_end/timeline/TimelineFlameChartDataP
node_modules/chrome-devtools-frontend/front_end/timeline/TimelineFlameChartDataProvider.js(621,36): error TS2339: Property 'preciseMillisToString' does not exist on type 'NumberConstructor'.
node_modules/chrome-devtools-frontend/front_end/timeline/TimelineFlameChartDataProvider.js(654,37): error TS2339: Property 'naturalHeight' does not exist on type 'new (width?: number, height?: number) => HTMLImageElement'.
node_modules/chrome-devtools-frontend/front_end/timeline/TimelineFlameChartDataProvider.js(655,39): error TS2339: Property 'naturalWidth' does not exist on type 'new (width?: number, height?: number) => HTMLImageElement'.
node_modules/chrome-devtools-frontend/front_end/timeline/TimelineFlameChartDataProvider.js(660,23): error TS2322: Type 'new (width?: number, height?: number) => HTMLImageElement' is not assignable to type 'CanvasImageSource'.
node_modules/chrome-devtools-frontend/front_end/timeline/TimelineFlameChartDataProvider.js(660,23): error TS2345: Argument of type 'new (width?: number, height?: number) => HTMLImageElement' is not assignable to parameter of type 'CanvasImageSource'.
Type 'new (width?: number, height?: number) => HTMLImageElement' is not assignable to type 'ImageBitmap'.
Property 'height' is missing in type 'new (width?: number, height?: number) => HTMLImageElement'.
node_modules/chrome-devtools-frontend/front_end/timeline/TimelineFlameChartDataProvider.js(788,33): error TS2694: Namespace 'PerfUI.FlameChart' has no exported member 'GroupStyle'.
@ -12519,7 +12528,7 @@ node_modules/chrome-devtools-frontend/front_end/timeline/TimelineUIUtils.js(1649
node_modules/chrome-devtools-frontend/front_end/timeline/TimelineUIUtils.js(1651,33): error TS2555: Expected at least 2 arguments, but got 1.
node_modules/chrome-devtools-frontend/front_end/timeline/TimelineUIUtils.js(1652,33): error TS2555: Expected at least 2 arguments, but got 1.
node_modules/chrome-devtools-frontend/front_end/timeline/TimelineUIUtils.js(1652,69): error TS2339: Property 'millisToString' does not exist on type 'NumberConstructor'.
node_modules/chrome-devtools-frontend/front_end/timeline/TimelineUIUtils.js(1657,64): error TS2322: Type 'new (width?: number, height?: number) => HTMLImageElement' is not assignable to type 'Node'.
node_modules/chrome-devtools-frontend/front_end/timeline/TimelineUIUtils.js(1657,64): error TS2345: Argument of type 'new (width?: number, height?: number) => HTMLImageElement' is not assignable to parameter of type 'Node'.
node_modules/chrome-devtools-frontend/front_end/timeline/TimelineUIUtils.js(1664,11): error TS2555: Expected at least 2 arguments, but got 1.
node_modules/chrome-devtools-frontend/front_end/timeline/TimelineUIUtils.js(1665,67): error TS2555: Expected at least 2 arguments, but got 1.
node_modules/chrome-devtools-frontend/front_end/timeline/TimelineUIUtils.js(1675,5): error TS2322: Type 'DocumentFragment' is not assignable to type 'Element'.
@ -12654,7 +12663,6 @@ node_modules/chrome-devtools-frontend/front_end/timeline_model/TimelineModel.js(
node_modules/chrome-devtools-frontend/front_end/timeline_model/TimelineModel.js(1780,33): error TS2694: Namespace 'Protocol' has no exported member 'Runtime'.
node_modules/chrome-devtools-frontend/front_end/timeline_model/TimelineModel.js(1811,25): error TS2694: Namespace 'Protocol' has no exported member 'Runtime'.
node_modules/chrome-devtools-frontend/front_end/timeline_model/TimelineModel.js(1819,32): error TS2694: Namespace 'Protocol' has no exported member 'Runtime'.
node_modules/chrome-devtools-frontend/front_end/timeline_model/TimelineModelFilter.js(43,22): error TS1110: Type expected.
node_modules/chrome-devtools-frontend/front_end/timeline_model/TimelineProfileTree.js(74,26): error TS2502: 'parent' is referenced directly or indirectly in its own type annotation.
node_modules/chrome-devtools-frontend/front_end/timeline_model/TimelineProfileTree.js(168,31): error TS2345: Argument of type 'string | symbol' is not assignable to parameter of type 'string'.
Type 'symbol' is not assignable to type 'string'.
@ -12911,6 +12919,7 @@ node_modules/chrome-devtools-frontend/front_end/ui/KeyboardShortcut.js(97,36): e
node_modules/chrome-devtools-frontend/front_end/ui/KeyboardShortcut.js(108,36): error TS2694: Namespace 'UI.KeyboardShortcut' has no exported member 'Descriptor'.
node_modules/chrome-devtools-frontend/front_end/ui/KeyboardShortcut.js(135,42): error TS2694: Namespace 'UI.KeyboardShortcut' has no exported member 'Key'.
node_modules/chrome-devtools-frontend/front_end/ui/KeyboardShortcut.js(144,42): error TS2694: Namespace 'UI.KeyboardShortcut' has no exported member 'Key'.
node_modules/chrome-devtools-frontend/front_end/ui/KeyboardShortcut.js(197,9): error TS1127: Invalid character.
node_modules/chrome-devtools-frontend/front_end/ui/KeyboardShortcut.js(216,21): error TS2551: Property 'Key' does not exist on type 'typeof KeyboardShortcut'. Did you mean 'Keys'?
node_modules/chrome-devtools-frontend/front_end/ui/KeyboardShortcut.js(218,50): error TS2694: Namespace 'UI.KeyboardShortcut' has no exported member 'Key'.
node_modules/chrome-devtools-frontend/front_end/ui/KeyboardShortcut.js(289,21): error TS2300: Duplicate identifier 'Descriptor'.

View File

@ -6,7 +6,7 @@ node_modules/debug/dist/debug.js(8,21): error TS2304: Cannot find name 'define'.
node_modules/debug/dist/debug.js(8,46): error TS2304: Cannot find name 'define'.
node_modules/debug/dist/debug.js(9,5): error TS2304: Cannot find name 'define'.
node_modules/debug/dist/debug.js(33,33): error TS2554: Expected 1 arguments, but got 2.
node_modules/debug/dist/debug.js(34,27): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'true | NodeRequire' has no compatible call signatures.
node_modules/debug/dist/debug.js(34,27): error TS2554: Expected 1 arguments, but got 2.
node_modules/debug/dist/debug.js(36,21): error TS2339: Property 'code' does not exist on type 'Error'.
node_modules/debug/dist/debug.js(89,38): error TS2339: Property 'length' does not exist on type 'string | number'.
Property 'length' does not exist on type 'number'.

View File

@ -1,17 +0,0 @@
Exit Code: 1
Standard output:
index.tsx(30,17): error TS7006: Parameter 'values' implicitly has an 'any' type.
index.tsx(43,9): error TS7006: Parameter 'values' implicitly has an 'any' type.
index.tsx(44,11): error TS7031: Binding element 'setSubmitting' implicitly has an 'any' type.
index.tsx(44,26): error TS7031: Binding element 'setErrors' implicitly has an 'any' type.
index.tsx(60,9): error TS7031: Binding element 'values' implicitly has an 'any' type.
index.tsx(61,9): error TS7031: Binding element 'errors' implicitly has an 'any' type.
index.tsx(62,9): error TS7031: Binding element 'touched' implicitly has an 'any' type.
index.tsx(63,9): error TS7031: Binding element 'handleChange' implicitly has an 'any' type.
index.tsx(64,9): error TS7031: Binding element 'handleBlur' implicitly has an 'any' type.
index.tsx(65,9): error TS7031: Binding element 'handleSubmit' implicitly has an 'any' type.
index.tsx(66,9): error TS7031: Binding element 'isSubmitting' implicitly has an 'any' type.
Standard error:

View File

@ -12,14 +12,6 @@ node_modules/graceful-fs/graceful-fs.js(161,5): error TS2539: Cannot assign to '
node_modules/graceful-fs/graceful-fs.js(162,5): error TS2539: Cannot assign to 'WriteStream' because it is not a variable.
node_modules/graceful-fs/graceful-fs.js(252,3): error TS2554: Expected 0 arguments, but got 3.
node_modules/graceful-fs/graceful-fs.js(259,5): error TS2554: Expected 0 arguments, but got 3.
node_modules/graceful-fs/polyfills.js(7,24): error TS2339: Property 'env' does not exist on type 'typeof process'.
node_modules/graceful-fs/polyfills.js(7,60): error TS2339: Property 'platform' does not exist on type 'typeof process'.
node_modules/graceful-fs/polyfills.js(32,15): error TS2339: Property 'version' does not exist on type 'typeof process'.
node_modules/graceful-fs/polyfills.js(73,23): error TS2339: Property 'nextTick' does not exist on type 'typeof process'.
node_modules/graceful-fs/polyfills.js(79,23): error TS2339: Property 'nextTick' does not exist on type 'typeof process'.
node_modules/graceful-fs/polyfills.js(229,62): error TS2339: Property 'nextTick' does not exist on type 'typeof process'.
node_modules/graceful-fs/polyfills.js(323,26): error TS2339: Property 'getuid' does not exist on type 'typeof process'.
node_modules/graceful-fs/polyfills.js(323,44): error TS2339: Property 'getuid' does not exist on type 'typeof process'.

View File

@ -1,8 +1,8 @@
Exit Code: 1
Standard output:
node_modules/jimp/jimp.d.ts(487,12): error TS7010: 'appendConstructorOption', which lacks return-type annotation, implicitly has an 'any' return type.
node_modules/jimp/jimp.d.ts(529,12): error TS7010: 'measureText', which lacks return-type annotation, implicitly has an 'any' return type.
node_modules/jimp/jimp.d.ts(530,12): error TS7010: 'measureTextHeight', which lacks return-type annotation, implicitly has an 'any' return type.
node_modules/jimp/jimp.d.ts(497,12): error TS7010: 'appendConstructorOption', which lacks return-type annotation, implicitly has an 'any' return type.
node_modules/jimp/jimp.d.ts(539,12): error TS7010: 'measureText', which lacks return-type annotation, implicitly has an 'any' return type.
node_modules/jimp/jimp.d.ts(540,12): error TS7010: 'measureTextHeight', which lacks return-type annotation, implicitly has an 'any' return type.

View File

@ -150,7 +150,7 @@ node_modules/lodash/_memoizeCapped.js(22,22): error TS2339: Property 'cache' doe
node_modules/lodash/_mergeData.js(60,26): error TS2554: Expected 4 arguments, but got 3.
node_modules/lodash/_mergeData.js(67,26): error TS2554: Expected 4 arguments, but got 3.
node_modules/lodash/_nodeUtil.js(7,80): error TS2339: Property 'nodeType' does not exist on type '{ "../../../tests/cases/user/lodash/node_modules/lodash/_nodeUtil": any; }'.
node_modules/lodash/_nodeUtil.js(13,47): error TS2339: Property 'process' does not exist on type 'boolean | Global'.
node_modules/lodash/_nodeUtil.js(13,47): error TS2339: Property 'process' does not exist on type 'false | Global'.
Property 'process' does not exist on type 'false'.
node_modules/lodash/_overRest.js(20,42): error TS2532: Object is possibly 'undefined'.
node_modules/lodash/_overRest.js(24,27): error TS2532: Object is possibly 'undefined'.
@ -251,12 +251,12 @@ node_modules/lodash/debounce.js(86,30): error TS2532: Object is possibly 'undefi
node_modules/lodash/debounce.js(111,23): error TS2532: Object is possibly 'undefined'.
node_modules/lodash/debounce.js(125,65): error TS2532: Object is possibly 'undefined'.
node_modules/lodash/deburr.js(42,44): error TS2345: Argument of type 'Function' is not assignable to parameter of type '(substring: string, ...args: any[]) => string'.
node_modules/lodash/difference.js(29,52): error TS2322: Type '(value: any) => boolean' is not assignable to type 'boolean | undefined'.
node_modules/lodash/difference.js(29,52): error TS2345: Argument of type '(value: any) => boolean' is not assignable to parameter of type 'boolean | undefined'.
Type '(value: any) => boolean' is not assignable to type 'true'.
node_modules/lodash/differenceBy.js(40,52): error TS2322: Type '(value: any) => boolean' is not assignable to type 'boolean | undefined'.
node_modules/lodash/differenceBy.js(40,52): error TS2345: Argument of type '(value: any) => boolean' is not assignable to parameter of type 'boolean | undefined'.
Type '(value: any) => boolean' is not assignable to type 'true'.
node_modules/lodash/differenceBy.js(40,78): error TS2554: Expected 0-1 arguments, but got 2.
node_modules/lodash/differenceWith.js(36,52): error TS2322: Type '(value: any) => boolean' is not assignable to type 'boolean | undefined'.
node_modules/lodash/differenceWith.js(36,52): error TS2345: Argument of type '(value: any) => boolean' is not assignable to parameter of type 'boolean | undefined'.
Type '(value: any) => boolean' is not assignable to type 'true'.
node_modules/lodash/drop.js(13,10): error TS1003: Identifier expected.
node_modules/lodash/drop.js(13,10): error TS8024: JSDoc '@param' tag has name '', but there is no parameter with that name.
@ -273,42 +273,42 @@ node_modules/lodash/findIndex.js(52,31): error TS2554: Expected 0-1 arguments, b
node_modules/lodash/findKey.js(41,30): error TS2554: Expected 0-1 arguments, but got 2.
node_modules/lodash/findLastIndex.js(56,31): error TS2554: Expected 0-1 arguments, but got 2.
node_modules/lodash/findLastKey.js(41,30): error TS2554: Expected 0-1 arguments, but got 2.
node_modules/lodash/fp/_baseConvert.js(144,5): error TS2559: Type 'Function' has no properties in common with type '{ cap?: boolean; curry?: boolean; fixed?: boolean; immutable?: boolean; rearg?: boolean; }'.
node_modules/lodash/fp/_baseConvert.js(145,5): error TS2322: Type 'string' is not assignable to type 'Function'.
node_modules/lodash/fp/_baseConvert.js(146,5): error TS2322: Type 'undefined' is not assignable to type 'string'.
node_modules/lodash/fp/_baseConvert.js(165,31): error TS2339: Property 'runInContext' does not exist on type 'Function'.
node_modules/lodash/fp/_baseConvert.js(184,21): error TS2339: Property 'ary' does not exist on type 'Function | { 'ary': any; 'assign': any; 'clone': any; 'curry': any; 'forEach': any; 'isArray': any; 'isError': any; 'isFunction': any; 'isWeakMap': any; 'iteratee': any; 'keys': any; 'rearg': any; 'toInteger': any; 'toPath': any; }'.
node_modules/lodash/fp/_baseConvert.js(143,5): error TS2559: Type 'Function' has no properties in common with type '{ cap?: boolean; curry?: boolean; fixed?: boolean; immutable?: boolean; rearg?: boolean; }'.
node_modules/lodash/fp/_baseConvert.js(144,5): error TS2322: Type 'string' is not assignable to type 'Function'.
node_modules/lodash/fp/_baseConvert.js(145,5): error TS2322: Type 'undefined' is not assignable to type 'string'.
node_modules/lodash/fp/_baseConvert.js(164,31): error TS2339: Property 'runInContext' does not exist on type 'Function'.
node_modules/lodash/fp/_baseConvert.js(183,21): error TS2339: Property 'ary' does not exist on type 'Function | { 'ary': any; 'assign': any; 'clone': any; 'curry': any; 'forEach': any; 'isArray': any; 'isError': any; 'isFunction': any; 'isWeakMap': any; 'iteratee': any; 'keys': any; 'rearg': any; 'toInteger': any; 'toPath': any; }'.
Property 'ary' does not exist on type 'Function'.
node_modules/lodash/fp/_baseConvert.js(185,24): error TS2339: Property 'assign' does not exist on type 'Function | { 'ary': any; 'assign': any; 'clone': any; 'curry': any; 'forEach': any; 'isArray': any; 'isError': any; 'isFunction': any; 'isWeakMap': any; 'iteratee': any; 'keys': any; 'rearg': any; 'toInteger': any; 'toPath': any; }'.
node_modules/lodash/fp/_baseConvert.js(184,24): error TS2339: Property 'assign' does not exist on type 'Function | { 'ary': any; 'assign': any; 'clone': any; 'curry': any; 'forEach': any; 'isArray': any; 'isError': any; 'isFunction': any; 'isWeakMap': any; 'iteratee': any; 'keys': any; 'rearg': any; 'toInteger': any; 'toPath': any; }'.
Property 'assign' does not exist on type 'Function'.
node_modules/lodash/fp/_baseConvert.js(186,23): error TS2339: Property 'clone' does not exist on type 'Function | { 'ary': any; 'assign': any; 'clone': any; 'curry': any; 'forEach': any; 'isArray': any; 'isError': any; 'isFunction': any; 'isWeakMap': any; 'iteratee': any; 'keys': any; 'rearg': any; 'toInteger': any; 'toPath': any; }'.
node_modules/lodash/fp/_baseConvert.js(185,23): error TS2339: Property 'clone' does not exist on type 'Function | { 'ary': any; 'assign': any; 'clone': any; 'curry': any; 'forEach': any; 'isArray': any; 'isError': any; 'isFunction': any; 'isWeakMap': any; 'iteratee': any; 'keys': any; 'rearg': any; 'toInteger': any; 'toPath': any; }'.
Property 'clone' does not exist on type 'Function'.
node_modules/lodash/fp/_baseConvert.js(187,23): error TS2339: Property 'curry' does not exist on type 'Function | { 'ary': any; 'assign': any; 'clone': any; 'curry': any; 'forEach': any; 'isArray': any; 'isError': any; 'isFunction': any; 'isWeakMap': any; 'iteratee': any; 'keys': any; 'rearg': any; 'toInteger': any; 'toPath': any; }'.
node_modules/lodash/fp/_baseConvert.js(186,23): error TS2339: Property 'curry' does not exist on type 'Function | { 'ary': any; 'assign': any; 'clone': any; 'curry': any; 'forEach': any; 'isArray': any; 'isError': any; 'isFunction': any; 'isWeakMap': any; 'iteratee': any; 'keys': any; 'rearg': any; 'toInteger': any; 'toPath': any; }'.
Property 'curry' does not exist on type 'Function'.
node_modules/lodash/fp/_baseConvert.js(188,22): error TS2339: Property 'forEach' does not exist on type 'Function | { 'ary': any; 'assign': any; 'clone': any; 'curry': any; 'forEach': any; 'isArray': any; 'isError': any; 'isFunction': any; 'isWeakMap': any; 'iteratee': any; 'keys': any; 'rearg': any; 'toInteger': any; 'toPath': any; }'.
node_modules/lodash/fp/_baseConvert.js(187,22): error TS2339: Property 'forEach' does not exist on type 'Function | { 'ary': any; 'assign': any; 'clone': any; 'curry': any; 'forEach': any; 'isArray': any; 'isError': any; 'isFunction': any; 'isWeakMap': any; 'iteratee': any; 'keys': any; 'rearg': any; 'toInteger': any; 'toPath': any; }'.
Property 'forEach' does not exist on type 'Function'.
node_modules/lodash/fp/_baseConvert.js(189,25): error TS2339: Property 'isArray' does not exist on type 'Function | { 'ary': any; 'assign': any; 'clone': any; 'curry': any; 'forEach': any; 'isArray': any; 'isError': any; 'isFunction': any; 'isWeakMap': any; 'iteratee': any; 'keys': any; 'rearg': any; 'toInteger': any; 'toPath': any; }'.
node_modules/lodash/fp/_baseConvert.js(188,25): error TS2339: Property 'isArray' does not exist on type 'Function | { 'ary': any; 'assign': any; 'clone': any; 'curry': any; 'forEach': any; 'isArray': any; 'isError': any; 'isFunction': any; 'isWeakMap': any; 'iteratee': any; 'keys': any; 'rearg': any; 'toInteger': any; 'toPath': any; }'.
Property 'isArray' does not exist on type 'Function'.
node_modules/lodash/fp/_baseConvert.js(190,25): error TS2339: Property 'isError' does not exist on type 'Function | { 'ary': any; 'assign': any; 'clone': any; 'curry': any; 'forEach': any; 'isArray': any; 'isError': any; 'isFunction': any; 'isWeakMap': any; 'iteratee': any; 'keys': any; 'rearg': any; 'toInteger': any; 'toPath': any; }'.
node_modules/lodash/fp/_baseConvert.js(189,25): error TS2339: Property 'isError' does not exist on type 'Function | { 'ary': any; 'assign': any; 'clone': any; 'curry': any; 'forEach': any; 'isArray': any; 'isError': any; 'isFunction': any; 'isWeakMap': any; 'iteratee': any; 'keys': any; 'rearg': any; 'toInteger': any; 'toPath': any; }'.
Property 'isError' does not exist on type 'Function'.
node_modules/lodash/fp/_baseConvert.js(191,28): error TS2339: Property 'isFunction' does not exist on type 'Function | { 'ary': any; 'assign': any; 'clone': any; 'curry': any; 'forEach': any; 'isArray': any; 'isError': any; 'isFunction': any; 'isWeakMap': any; 'iteratee': any; 'keys': any; 'rearg': any; 'toInteger': any; 'toPath': any; }'.
node_modules/lodash/fp/_baseConvert.js(190,28): error TS2339: Property 'isFunction' does not exist on type 'Function | { 'ary': any; 'assign': any; 'clone': any; 'curry': any; 'forEach': any; 'isArray': any; 'isError': any; 'isFunction': any; 'isWeakMap': any; 'iteratee': any; 'keys': any; 'rearg': any; 'toInteger': any; 'toPath': any; }'.
Property 'isFunction' does not exist on type 'Function'.
node_modules/lodash/fp/_baseConvert.js(192,27): error TS2339: Property 'isWeakMap' does not exist on type 'Function | { 'ary': any; 'assign': any; 'clone': any; 'curry': any; 'forEach': any; 'isArray': any; 'isError': any; 'isFunction': any; 'isWeakMap': any; 'iteratee': any; 'keys': any; 'rearg': any; 'toInteger': any; 'toPath': any; }'.
node_modules/lodash/fp/_baseConvert.js(191,27): error TS2339: Property 'isWeakMap' does not exist on type 'Function | { 'ary': any; 'assign': any; 'clone': any; 'curry': any; 'forEach': any; 'isArray': any; 'isError': any; 'isFunction': any; 'isWeakMap': any; 'iteratee': any; 'keys': any; 'rearg': any; 'toInteger': any; 'toPath': any; }'.
Property 'isWeakMap' does not exist on type 'Function'.
node_modules/lodash/fp/_baseConvert.js(193,22): error TS2339: Property 'keys' does not exist on type 'Function | { 'ary': any; 'assign': any; 'clone': any; 'curry': any; 'forEach': any; 'isArray': any; 'isError': any; 'isFunction': any; 'isWeakMap': any; 'iteratee': any; 'keys': any; 'rearg': any; 'toInteger': any; 'toPath': any; }'.
node_modules/lodash/fp/_baseConvert.js(192,22): error TS2339: Property 'keys' does not exist on type 'Function | { 'ary': any; 'assign': any; 'clone': any; 'curry': any; 'forEach': any; 'isArray': any; 'isError': any; 'isFunction': any; 'isWeakMap': any; 'iteratee': any; 'keys': any; 'rearg': any; 'toInteger': any; 'toPath': any; }'.
Property 'keys' does not exist on type 'Function'.
node_modules/lodash/fp/_baseConvert.js(194,23): error TS2339: Property 'rearg' does not exist on type 'Function | { 'ary': any; 'assign': any; 'clone': any; 'curry': any; 'forEach': any; 'isArray': any; 'isError': any; 'isFunction': any; 'isWeakMap': any; 'iteratee': any; 'keys': any; 'rearg': any; 'toInteger': any; 'toPath': any; }'.
node_modules/lodash/fp/_baseConvert.js(193,23): error TS2339: Property 'rearg' does not exist on type 'Function | { 'ary': any; 'assign': any; 'clone': any; 'curry': any; 'forEach': any; 'isArray': any; 'isError': any; 'isFunction': any; 'isWeakMap': any; 'iteratee': any; 'keys': any; 'rearg': any; 'toInteger': any; 'toPath': any; }'.
Property 'rearg' does not exist on type 'Function'.
node_modules/lodash/fp/_baseConvert.js(195,27): error TS2339: Property 'toInteger' does not exist on type 'Function | { 'ary': any; 'assign': any; 'clone': any; 'curry': any; 'forEach': any; 'isArray': any; 'isError': any; 'isFunction': any; 'isWeakMap': any; 'iteratee': any; 'keys': any; 'rearg': any; 'toInteger': any; 'toPath': any; }'.
node_modules/lodash/fp/_baseConvert.js(194,27): error TS2339: Property 'toInteger' does not exist on type 'Function | { 'ary': any; 'assign': any; 'clone': any; 'curry': any; 'forEach': any; 'isArray': any; 'isError': any; 'isFunction': any; 'isWeakMap': any; 'iteratee': any; 'keys': any; 'rearg': any; 'toInteger': any; 'toPath': any; }'.
Property 'toInteger' does not exist on type 'Function'.
node_modules/lodash/fp/_baseConvert.js(196,24): error TS2339: Property 'toPath' does not exist on type 'Function | { 'ary': any; 'assign': any; 'clone': any; 'curry': any; 'forEach': any; 'isArray': any; 'isError': any; 'isFunction': any; 'isWeakMap': any; 'iteratee': any; 'keys': any; 'rearg': any; 'toInteger': any; 'toPath': any; }'.
node_modules/lodash/fp/_baseConvert.js(195,24): error TS2339: Property 'toPath' does not exist on type 'Function | { 'ary': any; 'assign': any; 'clone': any; 'curry': any; 'forEach': any; 'isArray': any; 'isError': any; 'isFunction': any; 'isWeakMap': any; 'iteratee': any; 'keys': any; 'rearg': any; 'toInteger': any; 'toPath': any; }'.
Property 'toPath' does not exist on type 'Function'.
node_modules/lodash/fp/_baseConvert.js(263,57): error TS2345: Argument of type '{ cap?: boolean; curry?: boolean; fixed?: boolean; immutable?: boolean; rearg?: boolean; } | undefined' is not assignable to parameter of type 'Function'.
node_modules/lodash/fp/_baseConvert.js(262,57): error TS2345: Argument of type '{ cap?: boolean; curry?: boolean; fixed?: boolean; immutable?: boolean; rearg?: boolean; } | undefined' is not assignable to parameter of type 'Function'.
Type 'undefined' is not assignable to type 'Function'.
node_modules/lodash/fp/_baseConvert.js(379,14): error TS2339: Property 'runInContext' does not exist on type 'Function'.
node_modules/lodash/fp/_baseConvert.js(516,33): error TS2339: Property 'placeholder' does not exist on type 'Function'.
node_modules/lodash/fp/_baseConvert.js(559,5): error TS2339: Property 'convert' does not exist on type 'Function'.
node_modules/lodash/fp/_baseConvert.js(561,7): error TS2339: Property 'placeholder' does not exist on type 'Function'.
node_modules/lodash/fp/_baseConvert.js(378,14): error TS2339: Property 'runInContext' does not exist on type 'Function'.
node_modules/lodash/fp/_baseConvert.js(513,31): error TS2339: Property 'placeholder' does not exist on type 'Function'.
node_modules/lodash/fp/_baseConvert.js(556,5): error TS2339: Property 'convert' does not exist on type 'Function'.
node_modules/lodash/fp/_baseConvert.js(557,5): error TS2339: Property 'placeholder' does not exist on type 'Function'.
node_modules/lodash/fp/_convertBrowser.js(12,30): error TS2345: Argument of type 'Function' is not assignable to parameter of type 'string'.
node_modules/lodash/fp/_convertBrowser.js(15,12): error TS2304: Cannot find name '_'.
node_modules/lodash/fp/_convertBrowser.js(15,38): error TS2304: Cannot find name '_'.
@ -425,12 +425,12 @@ node_modules/lodash/truncate.js(78,16): error TS2454: Variable 'strSymbols' is u
node_modules/lodash/truncate.js(85,7): error TS2454: Variable 'strSymbols' is used before being assigned.
node_modules/lodash/unary.js(19,10): error TS2554: Expected 3 arguments, but got 2.
node_modules/lodash/unescape.js(30,37): error TS2345: Argument of type 'Function' is not assignable to parameter of type '(substring: string, ...args: any[]) => string'.
node_modules/lodash/union.js(23,42): error TS2322: Type '(value: any) => boolean' is not assignable to type 'boolean | undefined'.
node_modules/lodash/union.js(23,42): error TS2345: Argument of type '(value: any) => boolean' is not assignable to parameter of type 'boolean | undefined'.
Type '(value: any) => boolean' is not assignable to type 'true'.
node_modules/lodash/unionBy.js(36,42): error TS2322: Type '(value: any) => boolean' is not assignable to type 'boolean | undefined'.
node_modules/lodash/unionBy.js(36,42): error TS2345: Argument of type '(value: any) => boolean' is not assignable to parameter of type 'boolean | undefined'.
Type '(value: any) => boolean' is not assignable to type 'true'.
node_modules/lodash/unionBy.js(36,68): error TS2554: Expected 0-1 arguments, but got 2.
node_modules/lodash/unionWith.js(31,42): error TS2322: Type '(value: any) => boolean' is not assignable to type 'boolean | undefined'.
node_modules/lodash/unionWith.js(31,42): error TS2345: Argument of type '(value: any) => boolean' is not assignable to parameter of type 'boolean | undefined'.
Type '(value: any) => boolean' is not assignable to type 'true'.
node_modules/lodash/uniqBy.js(28,52): error TS2554: Expected 0-1 arguments, but got 2.
node_modules/lodash/words.js(15,10): error TS1003: Identifier expected.

View File

@ -1013,7 +1013,6 @@ node_modules/npm/test/network/registry.js(5,20): error TS2307: Cannot find modul
node_modules/npm/test/network/registry.js(29,47): error TS2339: Property '_extend' does not exist on type 'typeof import("util")'.
node_modules/npm/test/tap/00-check-mock-dep.js(12,20): error TS2732: Cannot find module 'npm-registry-mock/package.json'. Consider using '--resolveJsonModule' to import module with '.json' extension
node_modules/npm/test/tap/00-check-mock-dep.js(13,19): error TS2732: Cannot find module '../../package.json'. Consider using '--resolveJsonModule' to import module with '.json' extension
node_modules/npm/test/tap/00-config-setup.js(23,39): error TS2339: Property 'HOME' does not exist on type 'typeof env'.
node_modules/npm/test/tap/00-verify-bundle-deps.js(1,20): error TS2307: Cannot find module 'tap'.
node_modules/npm/test/tap/00-verify-bundle-deps.js(3,24): error TS2732: Cannot find module '../../package.json'. Consider using '--resolveJsonModule' to import module with '.json' extension
node_modules/npm/test/tap/00-verify-ls-ok.js(2,20): error TS2307: Cannot find module 'tap'.
@ -1223,19 +1222,13 @@ node_modules/npm/test/tap/gist-shortcut.js(7,29): error TS2307: Cannot find modu
node_modules/npm/test/tap/gist-shortcut.js(9,20): error TS2307: Cannot find module 'tap'.
node_modules/npm/test/tap/git-dependency-install-link.js(7,20): error TS2307: Cannot find module 'tap'.
node_modules/npm/test/tap/git-dependency-install-link.js(9,18): error TS2307: Cannot find module 'npm-registry-mock'.
node_modules/npm/test/tap/git-dependency-install-link.js(66,11): error TS2339: Property 'chdir' does not exist on type 'typeof process'.
node_modules/npm/test/tap/git-dependency-install-link.js(84,11): error TS2339: Property 'chdir' does not exist on type 'typeof process'.
node_modules/npm/test/tap/git-dependency-install-link.js(110,11): error TS2339: Property 'kill' does not exist on type 'typeof process'.
node_modules/npm/test/tap/git-dependency-install-link.js(125,7): error TS2339: Property 'load' does not exist on type 'typeof EventEmitter'.
node_modules/npm/test/tap/git-dependency-install-link.js(175,11): error TS2339: Property 'chdir' does not exist on type 'typeof process'.
node_modules/npm/test/tap/git-npmignore.js(7,20): error TS2307: Cannot find module 'tap'.
node_modules/npm/test/tap/git-npmignore.js(12,21): error TS2307: Cannot find module 'tacks'.
node_modules/npm/test/tap/git-prepare.js(8,22): error TS2307: Cannot find module 'tap'.
node_modules/npm/test/tap/git-prepare.js(9,20): error TS2307: Cannot find module 'npm-registry-mock'.
node_modules/npm/test/tap/git-prepare.js(19,21): error TS2307: Cannot find module 'tacks'.
node_modules/npm/test/tap/git-prepare.js(123,11): error TS2339: Property 'kill' does not exist on type 'typeof process'.
node_modules/npm/test/tap/git-prepare.js(131,7): error TS2339: Property 'load' does not exist on type 'typeof EventEmitter'.
node_modules/npm/test/tap/git-prepare.js(179,11): error TS2339: Property 'chdir' does not exist on type 'typeof process'.
node_modules/npm/test/tap/github-shortcut-package.js(7,29): error TS2307: Cannot find module 'require-inject'.
node_modules/npm/test/tap/github-shortcut-package.js(9,20): error TS2307: Cannot find module 'tap'.
node_modules/npm/test/tap/github-shortcut.js(10,31): error TS2307: Cannot find module 'require-inject'.
@ -1287,7 +1280,6 @@ node_modules/npm/test/tap/install-duplicate-deps-warning.js(8,20): error TS2307:
node_modules/npm/test/tap/install-from-local.js(7,20): error TS2307: Cannot find module 'tap'.
node_modules/npm/test/tap/install-into-likenamed-folder.js(6,20): error TS2307: Cannot find module 'tap'.
node_modules/npm/test/tap/install-link-scripts.js(7,20): error TS2307: Cannot find module 'tap'.
node_modules/npm/test/tap/install-link-scripts.js(130,11): error TS2339: Property 'chdir' does not exist on type 'typeof process'.
node_modules/npm/test/tap/install-local-dep-cycle.js(6,20): error TS2307: Cannot find module 'tap'.
node_modules/npm/test/tap/install-man.js(7,20): error TS2307: Cannot find module 'tap'.
node_modules/npm/test/tap/install-noargs-dev.js(5,18): error TS2307: Cannot find module 'npm-registry-mock'.

View File

@ -33,7 +33,7 @@ node_modules/uglify-js/lib/compress.js(3464,62): error TS2554: Expected 0 argume
node_modules/uglify-js/lib/compress.js(3690,23): error TS2554: Expected 0 arguments, but got 1.
node_modules/uglify-js/lib/compress.js(3711,24): error TS2339: Property 'parent' does not exist on type 'TreeTransformer'.
node_modules/uglify-js/lib/compress.js(3721,28): error TS2339: Property 'parent' does not exist on type 'TreeTransformer'.
node_modules/uglify-js/lib/compress.js(3880,21): error TS2403: Subsequent variable declarations must have the same type. Variable 'defs' must be of type 'Dictionary & { set: (key: any, val: any) => any; add: (key: any, val: any) => any; get: (key: any) => any; del: (key: any) => any; has: (key: any) => boolean; each: (f: any) => void; size: () => any; map: (f: any) => any[]; clone: () => Dictionary & any; toObject: () => any; }', but here has type 'any'.
node_modules/uglify-js/lib/compress.js(3880,21): error TS2403: Subsequent variable declarations must have the same type. Variable 'defs' must be of type 'Dictionary & { set: (key: any, val: any) => Dictionary & any; add: (key: any, val: any) => Dictionary & any; get: (key: any) => any; del: (key: any) => Dictionary & any; has: (key: any) => boolean; ... 4 more ...; toObject: () => any; }', but here has type 'any'.
node_modules/uglify-js/lib/compress.js(3932,17): error TS2447: The '|=' operator is not allowed for boolean types. Consider using '||' instead.
node_modules/uglify-js/lib/compress.js(3988,30): error TS2554: Expected 0 arguments, but got 1.
node_modules/uglify-js/lib/compress.js(4097,18): error TS2554: Expected 0 arguments, but got 1.

View File

@ -0,0 +1,45 @@
//// [voidReturnIndexUnionInference.ts]
// repro from https://github.com/Microsoft/TypeScript/issues/25274
export function safeInvoke<A1, R>(
func: ((arg1: A1) => R) | null | undefined,
arg1: A1
): R | undefined {
if (func) {
return func(arg1);
} else {
return undefined;
}
}
interface Props {
onFoo?(value: string): boolean;
onBar?(value: string): void;
}
function bad<P extends Props>(props: Readonly<P>) {
safeInvoke(props.onFoo, "blah");
// ERROR HERE!!!
// Type R in signature of safeInvoke incorrectly inferred as {} instead of void!
safeInvoke(props.onBar, "blah");
}
//// [voidReturnIndexUnionInference.js]
"use strict";
exports.__esModule = true;
// repro from https://github.com/Microsoft/TypeScript/issues/25274
function safeInvoke(func, arg1) {
if (func) {
return func(arg1);
}
else {
return undefined;
}
}
exports.safeInvoke = safeInvoke;
function bad(props) {
safeInvoke(props.onFoo, "blah");
// ERROR HERE!!!
// Type R in signature of safeInvoke incorrectly inferred as {} instead of void!
safeInvoke(props.onBar, "blah");
}

View File

@ -0,0 +1,68 @@
=== tests/cases/compiler/voidReturnIndexUnionInference.ts ===
// repro from https://github.com/Microsoft/TypeScript/issues/25274
export function safeInvoke<A1, R>(
>safeInvoke : Symbol(safeInvoke, Decl(voidReturnIndexUnionInference.ts, 0, 0))
>A1 : Symbol(A1, Decl(voidReturnIndexUnionInference.ts, 1, 27))
>R : Symbol(R, Decl(voidReturnIndexUnionInference.ts, 1, 30))
func: ((arg1: A1) => R) | null | undefined,
>func : Symbol(func, Decl(voidReturnIndexUnionInference.ts, 1, 34))
>arg1 : Symbol(arg1, Decl(voidReturnIndexUnionInference.ts, 2, 12))
>A1 : Symbol(A1, Decl(voidReturnIndexUnionInference.ts, 1, 27))
>R : Symbol(R, Decl(voidReturnIndexUnionInference.ts, 1, 30))
arg1: A1
>arg1 : Symbol(arg1, Decl(voidReturnIndexUnionInference.ts, 2, 47))
>A1 : Symbol(A1, Decl(voidReturnIndexUnionInference.ts, 1, 27))
): R | undefined {
>R : Symbol(R, Decl(voidReturnIndexUnionInference.ts, 1, 30))
if (func) {
>func : Symbol(func, Decl(voidReturnIndexUnionInference.ts, 1, 34))
return func(arg1);
>func : Symbol(func, Decl(voidReturnIndexUnionInference.ts, 1, 34))
>arg1 : Symbol(arg1, Decl(voidReturnIndexUnionInference.ts, 2, 47))
} else {
return undefined;
>undefined : Symbol(undefined)
}
}
interface Props {
>Props : Symbol(Props, Decl(voidReturnIndexUnionInference.ts, 10, 1))
onFoo?(value: string): boolean;
>onFoo : Symbol(Props.onFoo, Decl(voidReturnIndexUnionInference.ts, 12, 17))
>value : Symbol(value, Decl(voidReturnIndexUnionInference.ts, 13, 11))
onBar?(value: string): void;
>onBar : Symbol(Props.onBar, Decl(voidReturnIndexUnionInference.ts, 13, 35))
>value : Symbol(value, Decl(voidReturnIndexUnionInference.ts, 14, 11))
}
function bad<P extends Props>(props: Readonly<P>) {
>bad : Symbol(bad, Decl(voidReturnIndexUnionInference.ts, 15, 1))
>P : Symbol(P, Decl(voidReturnIndexUnionInference.ts, 17, 13))
>Props : Symbol(Props, Decl(voidReturnIndexUnionInference.ts, 10, 1))
>props : Symbol(props, Decl(voidReturnIndexUnionInference.ts, 17, 30))
>Readonly : Symbol(Readonly, Decl(lib.es5.d.ts, --, --))
>P : Symbol(P, Decl(voidReturnIndexUnionInference.ts, 17, 13))
safeInvoke(props.onFoo, "blah");
>safeInvoke : Symbol(safeInvoke, Decl(voidReturnIndexUnionInference.ts, 0, 0))
>props.onFoo : Symbol(onFoo, Decl(voidReturnIndexUnionInference.ts, 12, 17))
>props : Symbol(props, Decl(voidReturnIndexUnionInference.ts, 17, 30))
>onFoo : Symbol(onFoo, Decl(voidReturnIndexUnionInference.ts, 12, 17))
// ERROR HERE!!!
// Type R in signature of safeInvoke incorrectly inferred as {} instead of void!
safeInvoke(props.onBar, "blah");
>safeInvoke : Symbol(safeInvoke, Decl(voidReturnIndexUnionInference.ts, 0, 0))
>props.onBar : Symbol(onBar, Decl(voidReturnIndexUnionInference.ts, 13, 35))
>props : Symbol(props, Decl(voidReturnIndexUnionInference.ts, 17, 30))
>onBar : Symbol(onBar, Decl(voidReturnIndexUnionInference.ts, 13, 35))
}

View File

@ -0,0 +1,61 @@
=== tests/cases/compiler/voidReturnIndexUnionInference.ts ===
// repro from https://github.com/Microsoft/TypeScript/issues/25274
export function safeInvoke<A1, R>(
>safeInvoke : <A1, R>(func: ((arg1: A1) => R) | null | undefined, arg1: A1) => R | undefined
func: ((arg1: A1) => R) | null | undefined,
>func : ((arg1: A1) => R) | null | undefined
>arg1 : A1
>null : null
arg1: A1
>arg1 : A1
): R | undefined {
if (func) {
>func : ((arg1: A1) => R) | null | undefined
return func(arg1);
>func(arg1) : R
>func : (arg1: A1) => R
>arg1 : A1
} else {
return undefined;
>undefined : undefined
}
}
interface Props {
onFoo?(value: string): boolean;
>onFoo : ((value: string) => boolean) | undefined
>value : string
onBar?(value: string): void;
>onBar : ((value: string) => void) | undefined
>value : string
}
function bad<P extends Props>(props: Readonly<P>) {
>bad : <P extends Props>(props: Readonly<P>) => void
>props : Readonly<P>
safeInvoke(props.onFoo, "blah");
>safeInvoke(props.onFoo, "blah") : boolean | undefined
>safeInvoke : <A1, R>(func: ((arg1: A1) => R) | null | undefined, arg1: A1) => R | undefined
>props.onFoo : P["onFoo"]
>props : Readonly<P>
>onFoo : P["onFoo"]
>"blah" : "blah"
// ERROR HERE!!!
// Type R in signature of safeInvoke incorrectly inferred as {} instead of void!
safeInvoke(props.onBar, "blah");
>safeInvoke(props.onBar, "blah") : void | undefined
>safeInvoke : <A1, R>(func: ((arg1: A1) => R) | null | undefined, arg1: A1) => R | undefined
>props.onBar : P["onBar"]
>props : Readonly<P>
>onBar : P["onBar"]
>"blah" : "blah"
}

View File

@ -30,6 +30,36 @@ abstract class AbstractClass {
}
}
abstract class DerivedAbstractClass extends AbstractClass {
cb = (s: string) => {};
constructor(str: string, other: AbstractClass, yetAnother: DerivedAbstractClass) {
super(str, other);
// there is no implementation of 'prop' in any base class
this.cb(this.prop.toLowerCase());
this.method(1);
// OK, references are to another instance
other.cb(other.prop);
yetAnother.cb(yetAnother.prop);
}
}
class Implementation extends DerivedAbstractClass {
prop = "";
cb = (s: string) => {};
constructor(str: string, other: AbstractClass, yetAnother: DerivedAbstractClass) {
super(str, other, yetAnother);
this.cb(this.prop);
}
method(n: number) {
this.cb(this.prop + n);
}
}
class User {
constructor(a: AbstractClass) {
a.prop;

View File

@ -0,0 +1,10 @@
// @esModuleInterop: true
// @module: es2015
// @Filename: a.ts
import Namespace from "./b";
export var x = new Namespace.Foo();
// @Filename: b.d.ts
export class Foo {
member: string;
}

View File

@ -0,0 +1,29 @@
// @target: es6
// repro mostly from https://github.com/Microsoft/TypeScript/issues/25065
function getProperty2<T, K extends keyof T>(obj: T, key: Extract<K, string>): T[K] {
return obj[key];
}
function getProperty3<T, K extends Extract<keyof T, string>>(obj: T, key: K): T[K] {
return obj[key];
}
const s = Symbol();
interface StrNum {
first: string;
second: number;
[s]: string;
}
const obj: StrNum = {} as any;
let prop: string;
// should work
prop = getProperty2(obj, 'first');
prop = getProperty3(obj, 'first');
// Should fail
prop = getProperty2(obj, s);
prop = getProperty3(obj, s);

View File

@ -0,0 +1,24 @@
// @strict: true
// repro from https://github.com/Microsoft/TypeScript/issues/25274
export function safeInvoke<A1, R>(
func: ((arg1: A1) => R) | null | undefined,
arg1: A1
): R | undefined {
if (func) {
return func(arg1);
} else {
return undefined;
}
}
interface Props {
onFoo?(value: string): boolean;
onBar?(value: string): void;
}
function bad<P extends Props>(props: Readonly<P>) {
safeInvoke(props.onFoo, "blah");
// ERROR HERE!!!
// Type R in signature of safeInvoke incorrectly inferred as {} instead of void!
safeInvoke(props.onBar, "blah");
}

View File

@ -0,0 +1,7 @@
// @noEmit: true
// @allowJs: true
// @checkJs: true
// @Filename: bug27142.js
/** @enum {E} */
const E = { x: 0 };

View File

@ -0,0 +1,73 @@
// @strict: true
function f(b: boolean) {
function d() {
}
d.e = 12
d.e
if (b) {
d.q = false
}
// error d.q might not be assigned
d.q
if (b) {
d.q = false
}
else {
d.q = true
}
d.q
if (b) {
d.r = 1
}
else {
d.r = 2
}
d.r
if (b) {
d.s = 'hi'
}
return d
}
// OK to access possibly-unassigned properties outside the initialising scope
var test = f(true).s
function d() {
}
d.e = 12
d.e
if (!!false) {
d.q = false
}
d.q
if (!!false) {
d.q = false
}
else {
d.q = true
}
d.q
if (!!false) {
d.r = 1
}
else {
d.r = 2
}
d.r
// test function expressions too
const g = function() {
}
if (!!false) {
g.expando = 1
}
g.expando // error
if (!!false) {
g.both = 'hi'
}
else {
g.both = 0
}
g.both

View File

@ -0,0 +1,46 @@
// @noEmit: true
// @allowJs: true
// @checkJs: true
// @Filename: a.js
// @strict: true
// non top-level:
// all references to _map, set, get, addon should be ok
(function container() {
/** @constructor */
var Multimap = function() {
this._map = {};
this._map
this.set
this.get
this.addon
};
Multimap.prototype = {
set: function() {
this._map
this.set
this.get
this.addon
},
get() {
this._map
this.set
this.get
this.addon
}
}
Multimap.prototype.addon = function () {
this._map
this.set
this.get
this.addon
}
var mm = new Multimap();
mm._map
mm.set
mm.get
mm.addon
});

View File

@ -8,12 +8,12 @@
////export = [|T|];
// @Filename: /b.ts
////const x: import("[|./a|]") = 0;
////const y: import("[|./a|]").U = "";
////const x: import("[|./[|a|]|]") = 0;
////const y: import("[|./[|a|]|]").U = "";
verify.noErrors();
const [r0, r1, r2, r3, r4] = test.ranges();
const [r0, r1, r2, r3, r3b, r4, r4b] = test.ranges();
verify.referenceGroups(r0, [{ definition: "type T = number\nnamespace T", ranges: [r0, r2, r3] }]);
verify.referenceGroups(r1, [{ definition: "namespace T", ranges: [r1, r2] }]);
verify.referenceGroups(r2, [{ definition: "type T = number\nnamespace T", ranges: [r0, r1, r2, r3] }]);
@ -25,7 +25,7 @@ verify.referenceGroups([r3, r4], [
verify.renameLocations(r0, [r0, r2]);
verify.renameLocations(r1, [r1, r2]);
verify.renameLocations(r2, [r0, r1, r2]);
for (const range of [r3, r4]) {
for (const range of [r3b, r4b]) {
goTo.rangeStart(range);
verify.renameInfoSucceeded(/*displayName*/ "/a.ts", /*fullDisplayName*/ "/a.ts", /*kind*/ "module", /*kindModifiers*/ "", /*fileToRename*/ "/a.ts", range);
}

View File

@ -2,12 +2,12 @@
//// [|f1/*0*/();|]
// @Filename: module.ts
// @Filename: jalapeño.ts
//// export function f1() {}
//// export var v1 = 5;
verify.importFixAtPosition([
`import { f1 } from "./module";
`import { f1 } from "./jalapeño";
f1();`
]);

View File

@ -2,6 +2,9 @@
// @allowJs: true
// @Filename: /node_modules/global/index.d.ts
////export const x: number;
// @Filename: /a.ts
////export const x = 0;
@ -9,13 +12,14 @@
////export const x = 0;
// @Filename: /b.ts
////import * as a from "[|./a|]";
////import a2 = require("[|./a|]");
////import * as dir from "[|{| "target": "dir" |}./dir|]";
////import * as dir2 from "[|{| "target": "dir/index" |}./dir/index|]";
////import * as a from "./[|a|]";
////import a2 = require("./[|a|]");
////import * as dir from "./[|{| "target": "dir" |}dir|]";
////import * as dir2 from "./dir/[|{| "target": "dir/index" |}index|]";
// @Filename: /c.js
////const a = require("[|./a|]");
////const a = require("./[|a|]");
////const global = require("/*global*/global");
verify.noErrors();
goTo.eachRange(range => {
@ -24,3 +28,6 @@ goTo.eachRange(range => {
const kind = target === "dir" ? "directory" : "module";
verify.renameInfoSucceeded(/*displayName*/ name, /*fullDisplayName*/ name, /*kind*/ kind, /*kindModifiers*/ "", /*fileToRename*/ name, range);
});
goTo.marker("global");
verify.renameInfoFailed("You cannot rename a module via a global import.");