@@ -5427,52 +5427,61 @@ export const enum ContextFlags {
5427
5427
SkipBindingPatterns = 1 << 3 , // Ignore contextual types applied by binding patterns
5428
5428
}
5429
5429
5430
+ export type NodeBuilderFlags = bigint ;
5431
+
5430
5432
// NOTE: If modifying this enum, must modify `TypeFormatFlags` too!
5431
5433
// dprint-ignore
5432
- export const enum NodeBuilderFlags {
5433
- None = 0 ,
5434
+ export const NodeBuilderFlags = {
5435
+ None : 0n ,
5434
5436
// Options
5435
- NoTruncation = 1 << 0 , // Don't truncate result
5436
- WriteArrayAsGenericType = 1 << 1 , // Write Array<T> instead T[]
5437
- GenerateNamesForShadowedTypeParams = 1 << 2 , // When a type parameter T is shadowing another T, generate a name for it so it can still be referenced
5438
- UseStructuralFallback = 1 << 3 , // When an alias cannot be named by its symbol, rather than report an error, fallback to a structural printout if possible
5439
- ForbidIndexedAccessSymbolReferences = 1 << 4 , // Forbid references like `I["a"]["b"]` - print `typeof I.a<x>.b<y>` instead
5440
- WriteTypeArgumentsOfSignature = 1 << 5 , // Write the type arguments instead of type parameters of the signature
5441
- UseFullyQualifiedType = 1 << 6 , // Write out the fully qualified type name (eg. Module.Type, instead of Type)
5442
- UseOnlyExternalAliasing = 1 << 7 , // Only use external aliases for a symbol
5443
- SuppressAnyReturnType = 1 << 8 , // If the return type is any-like and can be elided, don't offer a return type.
5444
- WriteTypeParametersInQualifiedName = 1 << 9 ,
5445
- MultilineObjectLiterals = 1 << 10 , // Always write object literals across multiple lines
5446
- WriteClassExpressionAsTypeLiteral = 1 << 11 , // Write class {} as { new(): {} } - used for mixin declaration emit
5447
- UseTypeOfFunction = 1 << 12 , // Build using typeof instead of function type literal
5448
- OmitParameterModifiers = 1 << 13 , // Omit modifiers on parameters
5449
- UseAliasDefinedOutsideCurrentScope = 1 << 14 , // Allow non-visible aliases
5450
- UseSingleQuotesForStringLiteralType = 1 << 28 , // Use single quotes for string literal type
5451
- NoTypeReduction = 1 << 29 , // Don't call getReducedType
5452
- OmitThisParameter = 1 << 25 ,
5437
+ NoTruncation : 1n << 0n , // Don't truncate result
5438
+ WriteArrayAsGenericType : 1n << 1n , // Write Array<T> instead T[]
5439
+ GenerateNamesForShadowedTypeParams : 1n << 2n , // When a type parameter T is shadowing another T, generate a name for it so it can still be referenced
5440
+ UseStructuralFallback : 1n << 3n , // When an alias cannot be named by its symbol, rather than report an error, fallback to a structural printout if possible
5441
+ ForbidIndexedAccessSymbolReferences : 1n << 4n , // Forbid references like `I["a"]["b"]` - print `typeof I.a<x>.b<y>` instead
5442
+ WriteTypeArgumentsOfSignature : 1n << 5n , // Write the type arguments instead of type parameters of the signature
5443
+ UseFullyQualifiedType : 1n << 6n , // Write out the fully qualified type name (eg. Module.Type, instead of Type)
5444
+ UseOnlyExternalAliasing : 1n << 7n , // Only use external aliases for a symbol
5445
+ SuppressAnyReturnType : 1n << 8n , // If the return type is any-like and can be elided, don't offer a return type.
5446
+ WriteTypeParametersInQualifiedName : 1n << 9n ,
5447
+ MultilineObjectLiterals : 1n << 10n , // Always write object literals across multiple lines
5448
+ WriteClassExpressionAsTypeLiteral : 1n << 11n , // Write class {} as { new(): {} } - used for mixin declaration emit
5449
+ UseTypeOfFunction : 1n << 12n , // Build using typeof instead of function type literal
5450
+ OmitParameterModifiers : 1n << 13n , // Omit modifiers on parameters
5451
+ UseAliasDefinedOutsideCurrentScope : 1n << 14n , // Allow non-visible aliases
5452
+ UseSingleQuotesForStringLiteralType : 1n << 28n , // Use single quotes for string literal type
5453
+ NoTypeReduction : 1n << 29n , // Don't call getReducedType
5454
+ OmitThisParameter : 1n << 25n ,
5453
5455
5454
5456
// Error handling
5455
- AllowThisInObjectLiteral = 1 << 15 ,
5456
- AllowQualifiedNameInPlaceOfIdentifier = 1 << 16 ,
5457
- AllowAnonymousIdentifier = 1 << 17 ,
5458
- AllowEmptyUnionOrIntersection = 1 << 18 ,
5459
- AllowEmptyTuple = 1 << 19 ,
5460
- AllowUniqueESSymbolType = 1 << 20 ,
5461
- AllowEmptyIndexInfoType = 1 << 21 ,
5462
- /** @internal */ WriteComputedProps = 1 << 30 , // { [E.A]: 1 }
5463
- /** @internal */ NoSyntacticPrinter = 1 << 31 ,
5457
+ AllowThisInObjectLiteral : 1n << 15n ,
5458
+ AllowQualifiedNameInPlaceOfIdentifier : 1n << 16n ,
5459
+ AllowAnonymousIdentifier : 1n << 17n ,
5460
+ AllowEmptyUnionOrIntersection : 1n << 18n ,
5461
+ AllowEmptyTuple : 1n << 19n ,
5462
+ AllowUniqueESSymbolType : 1n << 20n ,
5463
+ AllowEmptyIndexInfoType : 1n << 21n ,
5464
+ /** @internal */ WriteComputedProps : 1n << 30n , // { [E.A]: 1 }
5465
+ /** @internal */ NoSyntacticPrinter : 1n << 31n ,
5464
5466
// Errors (cont.)
5465
- AllowNodeModulesRelativePaths = 1 << 26 ,
5466
- /** @internal */ DoNotIncludeSymbolChain = 1 << 27 , // Skip looking up and printing an accessible symbol chain
5467
- /** @internal */ AllowUnresolvedNames = 1 << 32 ,
5468
-
5469
- IgnoreErrors = AllowThisInObjectLiteral | AllowQualifiedNameInPlaceOfIdentifier | AllowAnonymousIdentifier | AllowEmptyUnionOrIntersection | AllowEmptyTuple | AllowEmptyIndexInfoType | AllowNodeModulesRelativePaths ,
5467
+ AllowNodeModulesRelativePaths : 1n << 26n ,
5468
+ /** @internal */ DoNotIncludeSymbolChain : 1n << 27n , // Skip looking up and printing an accessible symbol chain
5469
+ /** @internal */ AllowUnresolvedNames : 1n << 32n ,
5470
5470
5471
5471
// State
5472
- InObjectTypeLiteral = 1 << 22 ,
5473
- InTypeAlias = 1 << 23 , // Writing type in type alias declaration
5474
- InInitialEntityName = 1 << 24 , // Set when writing the LHS of an entity name or entity name expression
5475
- }
5472
+ InObjectTypeLiteral : 1n << 22n ,
5473
+ InTypeAlias : 1n << 23n , // Writing type in type alias declaration
5474
+ InInitialEntityName : 1n << 24n , // Set when writing the LHS of an entity name or entity name expression
5475
+ }
5476
+
5477
+ export const NodeBuilderFlagsIgnoreErrors =
5478
+ NodeBuilderFlags . AllowThisInObjectLiteral
5479
+ | NodeBuilderFlags . AllowQualifiedNameInPlaceOfIdentifier
5480
+ | NodeBuilderFlags . AllowAnonymousIdentifier
5481
+ | NodeBuilderFlags . AllowEmptyUnionOrIntersection
5482
+ | NodeBuilderFlags . AllowEmptyTuple
5483
+ | NodeBuilderFlags . AllowEmptyIndexInfoType
5484
+ | NodeBuilderFlags . AllowNodeModulesRelativePaths ;
5476
5485
5477
5486
// Ensure the shared flags between this and `NodeBuilderFlags` stay in alignment
5478
5487
// dprint-ignore
0 commit comments