@@ -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 ,
@@ -2803,6 +2797,7 @@ namespace ts {
28032797 UnionOrIntersection = Union | Intersection ,
28042798 StructuredType = Object | Union | Intersection ,
28052799 StructuredOrTypeParameter = StructuredType | TypeParameter | Index ,
2800+ TypeVariable = TypeParameter | IndexedAccess ,
28062801
28072802 // 'Narrowable' types are types where narrowing actually narrows.
28082803 // This *should* be every type other than null, undefined, void, and never
@@ -2913,7 +2908,7 @@ namespace ts {
29132908 /* @internal */
29142909 resolvedProperties : SymbolTable ; // Cache of resolved properties
29152910 /* @internal */
2916- couldContainTypeParameters : boolean ;
2911+ couldContainTypeVariables : boolean ;
29172912 }
29182913
29192914 export interface UnionType extends UnionOrIntersectionType { }
@@ -2969,8 +2964,13 @@ namespace ts {
29692964 iteratorElementType ?: Type ;
29702965 }
29712966
2967+ export interface TypeVariable extends Type {
2968+ /* @internal */
2969+ resolvedIndexType : IndexType ;
2970+ }
2971+
29722972 // Type parameters (TypeFlags.TypeParameter)
2973- export interface TypeParameter extends Type {
2973+ export interface TypeParameter extends TypeVariable {
29742974 constraint : Type ; // Constraint
29752975 /* @internal */
29762976 target ?: TypeParameter ; // Instantiation target
@@ -2979,20 +2979,21 @@ namespace ts {
29792979 /* @internal */
29802980 resolvedApparentType : Type ;
29812981 /* @internal */
2982- resolvedIndexType : IndexType ;
2983- /* @internal */
29842982 isThisType ?: boolean ;
29852983 }
29862984
2987- export interface IndexType extends Type {
2988- type : TypeParameter ;
2989- }
2990-
2991- export interface IndexedAccessType extends Type {
2985+ // Indexed access types (TypeFlags.IndexedAccess)
2986+ // Possible forms are T[xxx], xxx[T], or xxx[keyof T], where T is a type variable
2987+ export interface IndexedAccessType extends TypeVariable {
29922988 objectType : Type ;
29932989 indexType : Type ;
29942990 }
29952991
2992+ // keyof T types (TypeFlags.Index)
2993+ export interface IndexType extends Type {
2994+ type : TypeVariable ;
2995+ }
2996+
29962997 export const enum SignatureKind {
29972998 Call ,
29982999 Construct ,
@@ -3698,6 +3699,25 @@ namespace ts {
36983699 readonly priority ?: number ; // Helpers with a higher priority are emitted earlier than other helpers on the node.
36993700 }
37003701
3702+ /**
3703+ * Used by the checker, this enum keeps track of external emit helpers that should be type
3704+ * checked.
3705+ */
3706+ /* @internal */
3707+ export const enum ExternalEmitHelpers {
3708+ Extends = 1 << 0 , // __extends (used by the ES2015 class transformation)
3709+ Assign = 1 << 1 , // __assign (used by Jsx and ESNext object spread transformations)
3710+ Rest = 1 << 2 , // __rest (used by ESNext object rest transformation)
3711+ Decorate = 1 << 3 , // __decorate (used by TypeScript decorators transformation)
3712+ Metadata = 1 << 4 , // __metadata (used by TypeScript decorators transformation)
3713+ Param = 1 << 5 , // __param (used by TypeScript decorators transformation)
3714+ Awaiter = 1 << 6 , // __awaiter (used by ES2017 async functions transformation)
3715+ Generator = 1 << 7 , // __generator (used by ES2015 generator transformation)
3716+
3717+ FirstEmitHelper = Extends ,
3718+ LastEmitHelper = Generator
3719+ }
3720+
37013721 /* @internal */
37023722 export const enum EmitContext {
37033723 SourceFile , // Emitting a SourceFile
0 commit comments