mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
@@ -107,7 +107,7 @@ module ts {
|
||||
isImplementationOfOverload: isImplementationOfOverload
|
||||
};
|
||||
|
||||
var undefinedSymbol = createSymbol(SymbolFlags.Property | SymbolFlags.Transient, "undefined");
|
||||
var undefinedSymbol = createSymbol(SymbolFlags.Undefined | SymbolFlags.Property | SymbolFlags.Transient, "undefined");
|
||||
var argumentsSymbol = createSymbol(SymbolFlags.Property | SymbolFlags.Transient, "arguments");
|
||||
var unknownSymbol = createSymbol(SymbolFlags.Property | SymbolFlags.Transient, "unknown");
|
||||
var resolvingSymbol = createSymbol(SymbolFlags.Transient, "__resolving__");
|
||||
@@ -1067,7 +1067,12 @@ module ts {
|
||||
return writeType(type, flags | TypeFormatFlags.WriteArrowStyleSignature);
|
||||
|
||||
function writeType(type: Type, flags: TypeFormatFlags) {
|
||||
if (type.flags & TypeFlags.Intrinsic) {
|
||||
// Write undefined/null type as any
|
||||
if ((flags & TypeFormatFlags.WriteUndefinedAndNullAsAny) &&
|
||||
((type.flags & TypeFlags.Undefined) || (type.flags & TypeFlags.Null))) {
|
||||
writeKeyword(writer, SyntaxKind.AnyKeyword);
|
||||
}
|
||||
else if (type.flags & TypeFlags.Intrinsic) {
|
||||
// Special handling for unknown / resolving types, they should show up as any and not unknown or __resolving
|
||||
writer.writeKind(!(flags & TypeFormatFlags.WriteOwnNameForAnyLike) &&
|
||||
(type.flags & TypeFlags.Any) ? "any" : (<IntrinsicType>type).intrinsicName, SymbolDisplayPartKind.keyword);
|
||||
|
||||
+10
-7
@@ -679,13 +679,14 @@ module ts {
|
||||
}
|
||||
|
||||
export enum TypeFormatFlags {
|
||||
None = 0x00000000,
|
||||
WriteArrayAsGenericType = 0x00000001, // Write Array<T> instead T[]
|
||||
UseTypeOfFunction = 0x00000002, // Write typeof instead of function type literal
|
||||
NoTruncation = 0x00000004, // Don't truncate typeToString result
|
||||
WriteArrowStyleSignature= 0x00000008, // Write arrow style signature
|
||||
WriteOwnNameForAnyLike = 0x00000010, // Write symbol's own name instead of 'any' for any like types (eg. unknown, __resolving__ etc)
|
||||
WriteTypeArgumentsOfSignature = 0x00000020, // Write the type arguments instead of type parameters of the signature
|
||||
None = 0x00000000,
|
||||
WriteArrayAsGenericType = 0x00000001, // Write Array<T> instead T[]
|
||||
UseTypeOfFunction = 0x00000002, // Write typeof instead of function type literal
|
||||
NoTruncation = 0x00000004, // Don't truncate typeToString result
|
||||
WriteArrowStyleSignature = 0x00000008, // Write arrow style signature
|
||||
WriteOwnNameForAnyLike = 0x00000010, // Write symbol's own name instead of 'any' for any like types (eg. unknown, __resolving__ etc)
|
||||
WriteTypeArgumentsOfSignature = 0x00000020, // Write the type arguments instead of type parameters of the signature
|
||||
WriteUndefinedAndNullAsAny = 0x00000040, // Write undefined and null as any
|
||||
}
|
||||
|
||||
export enum SymbolFormatFlags {
|
||||
@@ -763,6 +764,8 @@ module ts {
|
||||
Transient = 0x02000000, // Transient symbol (created during type check)
|
||||
Prototype = 0x04000000, // Symbol for the prototype property (without source code representation)
|
||||
|
||||
Undefined = 0x08000000, // Symbol for the undefined
|
||||
|
||||
Value = Variable | Property | EnumMember | Function | Class | Enum | ValueModule | Method | GetAccessor | SetAccessor,
|
||||
Type = Class | Interface | Enum | TypeLiteral | ObjectLiteral | TypeParameter,
|
||||
Namespace = ValueModule | NamespaceModule,
|
||||
|
||||
Reference in New Issue
Block a user