diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index fa81541d517..729fbdcaa52 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -2232,20 +2232,17 @@ namespace ts { function typeFormatFlagsToNodeBuilderFlags(flags: TypeFormatFlags): NodeBuilderFlags { let result = NodeBuilderFlags.None; - if (flags & TypeFormatFlags.WriteArrayAsGenericType) { - result |= NodeBuilderFlags.WriteArrayAsGenericType; - } - if (flags & TypeFormatFlags.UseTypeOfFunction) { - result |= NodeBuilderFlags.UseTypeOfFunction; + if (flags === TypeFormatFlags.None) { + return result; } if (flags & TypeFormatFlags.NoTruncation) { result |= NodeBuilderFlags.NoTruncation; } - if (flags & TypeFormatFlags.WriteArrowStyleSignature) { - result |= NodeBuilderFlags.WriteArrowStyleSignature; + if (flags & TypeFormatFlags.UseFullyQualifiedType) { + result |= NodeBuilderFlags.UseFullyQualifiedType; } - if (flags & TypeFormatFlags.WriteOwnNameForAnyLike) { - result |= NodeBuilderFlags.WriteOwnNameForAnyLike; + if (flags & TypeFormatFlags.SuppressAnyReturnType) { + result |= NodeBuilderFlags.SuppressAnyReturnType; } if (flags & TypeFormatFlags.WriteArrayAsGenericType) { result |= NodeBuilderFlags.WriteArrayAsGenericType; @@ -2253,18 +2250,6 @@ namespace ts { if (flags & TypeFormatFlags.WriteTypeArgumentsOfSignature) { result |= NodeBuilderFlags.WriteTypeArgumentsOfSignature; } - if (flags & TypeFormatFlags.UseFullyQualifiedType) { - result |= NodeBuilderFlags.UseFullyQualifiedType; - } - if (flags & TypeFormatFlags.UseTypeAliasValue) { - result |= NodeBuilderFlags.UseTypeAliasValue; - } - if (flags & TypeFormatFlags.SuppressAnyReturnType) { - result |= NodeBuilderFlags.SuppressAnyReturnType; - } - if (flags & TypeFormatFlags.AddUndefined) { - result |= NodeBuilderFlags.AddUndefined; - } return result; } @@ -2893,7 +2878,6 @@ namespace ts { function createEntityNameFromSymbolChain(chain: Symbol[], index: number): EntityName { Debug.assert(chain && 0 <= index && index < chain.length); - // const parentIndex = index - 1; const symbol = chain[index]; let typeParameterNodes: TypeNode[] | undefined; if (index > 0) { diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 9191ad844f7..49f1e9a3382 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -2497,7 +2497,7 @@ namespace ts { /** Note that the resulting nodes cannot be checked. */ - typeToTypeNode(type: Type, enclosingDeclaration?: Node, flags?: NodeBuilderFlags, inTypeAlias?: boolean): TypeNode; + typeToTypeNode(type: Type, enclosingDeclaration?: Node, flags?: NodeBuilderFlags): TypeNode; /** Note that the resulting nodes cannot be checked. */ signatureToSignatureDeclaration(signature: Signature, kind: SyntaxKind, enclosingDeclaration?: Node, flags?: NodeBuilderFlags): SignatureDeclaration; /** Note that the resulting nodes cannot be checked. */ @@ -2562,22 +2562,10 @@ namespace ts { None = 0, // Options NoTruncation = 1 << 0, // Don't truncate result - // TODO: part of emit. WriteArrayAsGenericType = 1 << 1, // Write Array instead T[] - // TODO: part of emit. - UseTypeOfFunction = 1 << 2, // Write typeof instead of function type literal - // TODO: part of emit. - WriteArrowStyleSignature = 1 << 3, // Write arrow style signature - // TODO: turn it into a failing type reference? - WriteOwnNameForAnyLike = 1 << 4, // Write symbol's own name instead of 'any' for any like types (eg. unknown, __resolving__ etc) - // TODO WriteTypeArgumentsOfSignature = 1 << 5, // Write the type arguments instead of type parameters of the signature UseFullyQualifiedType = 1 << 6, // Write out the fully qualified type name (eg. Module.Type, instead of Type) - // TODO - UseTypeAliasValue = 1 << 7, // Serialize the type instead of using type-alias. This is needed when we emit declaration file. SuppressAnyReturnType = 1 << 8, // If the return type is any-like, don't offer a return type. - // TODO - AddUndefined = 1 << 9, // Add undefined to types of initialized, non-optional parameters // Error handling allowThisInObjectLiteral = 1 << 10, diff --git a/src/compiler/visitor.ts b/src/compiler/visitor.ts index fce43b622bb..ce7908b885e 100644 --- a/src/compiler/visitor.ts +++ b/src/compiler/visitor.ts @@ -359,7 +359,6 @@ namespace ts { case SyntaxKind.PropertySignature: return updatePropertySignature((node), - // TODO: tokenVisitor or visitor for a nodearray of tokens? nodesVisitor((node).modifiers, visitor, isToken), visitNode((node).name, visitor, isPropertyName), visitNode((node).questionToken, tokenVisitor, isToken),