@@ -418,26 +418,20 @@ namespace ts {
418418 HasImplicitReturn = 1 << 7 , // If function implicitly returns on one of codepaths (initialized by binding)
419419 HasExplicitReturn = 1 << 8 , // If function has explicit reachable return on one of codepaths (initialized by binding)
420420 GlobalAugmentation = 1 << 9 , // Set if module declaration is an augmentation for the global scope
421- HasClassExtends = 1 << 10 , // If the file has a non-ambient class with an extends clause in ES5 or lower (initialized by binding)
422- HasDecorators = 1 << 11 , // If the file has decorators (initialized by binding)
423- HasParamDecorators = 1 << 12 , // If the file has parameter decorators (initialized by binding)
424- HasAsyncFunctions = 1 << 13 , // If the file has async functions (initialized by binding)
425- HasSpreadAttribute = 1 << 14 , // If the file as JSX spread attributes (initialized by binding)
426- HasRestAttribute = 1 << 15 , // If the file has object destructure elements
427- DisallowInContext = 1 << 16 , // If node was parsed in a context where 'in-expressions' are not allowed
428- YieldContext = 1 << 17 , // If node was parsed in the 'yield' context created when parsing a generator
429- DecoratorContext = 1 << 18 , // If node was parsed as part of a decorator
430- AwaitContext = 1 << 19 , // If node was parsed in the 'await' context created when parsing an async function
431- ThisNodeHasError = 1 << 20 , // If the parser encountered an error when parsing the code that created this node
432- JavaScriptFile = 1 << 21 , // If node was parsed in a JavaScript
433- ThisNodeOrAnySubNodesHasError = 1 << 22 , // If this node or any of its children had an error
434- HasAggregatedChildData = 1 << 23 , // If we've computed data from children and cached it in this node
421+ HasAsyncFunctions = 1 << 10 , // If the file has async functions (initialized by binding)
422+ DisallowInContext = 1 << 11 , // If node was parsed in a context where 'in-expressions' are not allowed
423+ YieldContext = 1 << 12 , // If node was parsed in the 'yield' context created when parsing a generator
424+ DecoratorContext = 1 << 13 , // If node was parsed as part of a decorator
425+ AwaitContext = 1 << 14 , // If node was parsed in the 'await' context created when parsing an async function
426+ ThisNodeHasError = 1 << 15 , // If the parser encountered an error when parsing the code that created this node
427+ JavaScriptFile = 1 << 16 , // If node was parsed in a JavaScript
428+ ThisNodeOrAnySubNodesHasError = 1 << 17 , // If this node or any of its children had an error
429+ HasAggregatedChildData = 1 << 18 , // If we've computed data from children and cached it in this node
435430
436431 BlockScoped = Let | Const ,
437432
438433 ReachabilityCheckFlags = HasImplicitReturn | HasExplicitReturn ,
439- EmitHelperFlags = HasClassExtends | HasDecorators | HasParamDecorators | HasAsyncFunctions | HasSpreadAttribute | HasRestAttribute ,
440- ReachabilityAndEmitFlags = ReachabilityCheckFlags | EmitHelperFlags ,
434+ ReachabilityAndEmitFlags = ReachabilityCheckFlags | HasAsyncFunctions ,
441435
442436 // Parsing context flags
443437 ContextFlags = DisallowInContext | YieldContext | DecoratorContext | AwaitContext | JavaScriptFile ,
@@ -2808,6 +2802,7 @@ namespace ts {
28082802 UnionOrIntersection = Union | Intersection ,
28092803 StructuredType = Object | Union | Intersection ,
28102804 StructuredOrTypeParameter = StructuredType | TypeParameter | Index ,
2805+ TypeVariable = TypeParameter | IndexedAccess ,
28112806
28122807 // 'Narrowable' types are types where narrowing actually narrows.
28132808 // This *should* be every type other than null, undefined, void, and never
@@ -2920,7 +2915,9 @@ namespace ts {
29202915 /* @internal */
29212916 resolvedProperties : SymbolTable ; // Cache of resolved properties
29222917 /* @internal */
2923- couldContainTypeParameters : boolean ;
2918+ resolvedIndexType : IndexType ;
2919+ /* @internal */
2920+ couldContainTypeVariables : boolean ;
29242921 }
29252922
29262923 export interface UnionType extends UnionOrIntersectionType { }
@@ -2976,8 +2973,13 @@ namespace ts {
29762973 iteratorElementType ?: Type ;
29772974 }
29782975
2976+ export interface TypeVariable extends Type {
2977+ /* @internal */
2978+ resolvedIndexType : IndexType ;
2979+ }
2980+
29792981 // Type parameters (TypeFlags.TypeParameter)
2980- export interface TypeParameter extends Type {
2982+ export interface TypeParameter extends TypeVariable {
29812983 constraint : Type ; // Constraint
29822984 /* @internal */
29832985 target ?: TypeParameter ; // Instantiation target
@@ -2986,20 +2988,21 @@ namespace ts {
29862988 /* @internal */
29872989 resolvedApparentType : Type ;
29882990 /* @internal */
2989- resolvedIndexType : IndexType ;
2990- /* @internal */
29912991 isThisType ?: boolean ;
29922992 }
29932993
2994- export interface IndexType extends Type {
2995- type : TypeParameter ;
2996- }
2997-
2998- export interface IndexedAccessType extends Type {
2994+ // Indexed access types (TypeFlags.IndexedAccess)
2995+ // Possible forms are T[xxx], xxx[T], or xxx[keyof T], where T is a type variable
2996+ export interface IndexedAccessType extends TypeVariable {
29992997 objectType : Type ;
30002998 indexType : Type ;
30012999 }
30023000
3001+ // keyof T types (TypeFlags.Index)
3002+ export interface IndexType extends Type {
3003+ type : TypeVariable | UnionOrIntersectionType ;
3004+ }
3005+
30033006 export const enum SignatureKind {
30043007 Call ,
30053008 Construct ,
@@ -3705,6 +3708,25 @@ namespace ts {
37053708 readonly priority ?: number ; // Helpers with a higher priority are emitted earlier than other helpers on the node.
37063709 }
37073710
3711+ /**
3712+ * Used by the checker, this enum keeps track of external emit helpers that should be type
3713+ * checked.
3714+ */
3715+ /* @internal */
3716+ export const enum ExternalEmitHelpers {
3717+ Extends = 1 << 0 , // __extends (used by the ES2015 class transformation)
3718+ Assign = 1 << 1 , // __assign (used by Jsx and ESNext object spread transformations)
3719+ Rest = 1 << 2 , // __rest (used by ESNext object rest transformation)
3720+ Decorate = 1 << 3 , // __decorate (used by TypeScript decorators transformation)
3721+ Metadata = 1 << 4 , // __metadata (used by TypeScript decorators transformation)
3722+ Param = 1 << 5 , // __param (used by TypeScript decorators transformation)
3723+ Awaiter = 1 << 6 , // __awaiter (used by ES2017 async functions transformation)
3724+ Generator = 1 << 7 , // __generator (used by ES2015 generator transformation)
3725+
3726+ FirstEmitHelper = Extends ,
3727+ LastEmitHelper = Generator
3728+ }
3729+
37083730 /* @internal */
37093731 export const enum EmitContext {
37103732 SourceFile , // Emitting a SourceFile
0 commit comments