Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
09f7cf8
Add tests for ordering by content
jakebailey Nov 23, 2026
acd053d
Measure nested recursion by generation instead of type id
jakebailey Nov 23, 2026
dc0454f
Order and intern types by content instead of by type id
jakebailey Oct 20, 2026
e3457a9
Order nodes starting at the same position by their place in the tree
jakebailey Nov 21, 2026
74257de
Order symbols derived from the same declaration by how they were made
jakebailey Nov 21, 2026
739cffb
Order object types by everything they are interned by
jakebailey Nov 21, 2026
c23a9d1
Intern deferred conditional types by their content
jakebailey Nov 21, 2026
7309ddc
Order symbols made from other symbols by their origins
jakebailey Nov 21, 2026
eabe140
Order object types sharing a symbol by how they were created
jakebailey Nov 21, 2026
b904696
Order instantiated anonymous types by the types they instantiate
jakebailey Nov 21, 2026
2bdc0a0
Intern object types inferred from string literal keys
jakebailey Nov 21, 2026
850d2ae
Order members of types implied by binding patterns by their elements
jakebailey Nov 21, 2026
61ea410
Compare composite type mappers by their parts
jakebailey Nov 21, 2026
03fdc97
Intern spreads of a union of an object type and empty objects
jakebailey Nov 22, 2026
f75ed04
Assert that types and symbols are never ordered by id
jakebailey Nov 21, 2026
5ae62f2
Check assertion operands once, with their normal type
jakebailey Oct 19, 2026
9dfe82c
Derive binding pattern parent types without peeking at caches
jakebailey Oct 19, 2026
fc09a99
Make contextual typing of functions deterministic
jakebailey Oct 19, 2026
3645128
Resolve calls in source order and locate their errors at the call
jakebailey Oct 19, 2026
e7af750
Do not cache results that depend on who asked first
jakebailey Oct 19, 2026
a558598
Report unresolved names after resolution completes
jakebailey Oct 19, 2026
59ed2c3
Make flow analysis of a reference independent of other references
jakebailey Oct 19, 2026
1080b86
Track computed property name cycles on the resolution stack
jakebailey Oct 19, 2026
c620a23
Cache relation results only once their assumptions are resolved
jakebailey Oct 20, 2026
b732918
Look through instantiation when reusing a parameter name
jakebailey Oct 22, 2026
90de7fe
Check computed enum initializers when checking the member
jakebailey Oct 22, 2026
be33c23
Instantiate symbols whether or not their types are known
jakebailey Nov 7, 2026
1bf3a84
Keep declaration emit's visibility marks apart from cached visibility
jakebailey Nov 7, 2026
ba101b7
Do not count names resolved to print a type as uses
jakebailey Nov 7, 2026
54737ad
Do not let names in JSDoc keep imports
jakebailey Nov 7, 2026
6538cb6
Resolve the type of an accessor before the return type of its getter
jakebailey Nov 7, 2026
a18e630
Decide restrictive type parameters from their declarations
jakebailey Nov 8, 2026
1d9f55d
Find the contextual type of a node from the innermost check of it
jakebailey Nov 8, 2026
baee21c
Keep the narrowing of a type variable in a conditional's true branch
jakebailey Nov 9, 2026
d4159d3
Analyze each flow loop independently of the reference reaching it
jakebailey Nov 11, 2026
2f16c11
Make base constraints independent of the walk that reaches them
jakebailey Dec 2, 2026
dd2163c
Give up on conditional types that expand without end
jakebailey Nov 23, 2026
702bfc1
Assign contextual parameter types before reading a parameter
jakebailey Nov 12, 2026
d0ecff8
Check imported names despite invalid import attribute values
jakebailey Nov 12, 2026
dd072d8
Infer the constraint of an infer type parameter without instantiating
jakebailey Nov 12, 2026
605e227
Instantiate an instantiation expression with the type arguments given
jakebailey Nov 13, 2026
43cbd5a
Count only expanding type references as nested recursion
jakebailey Nov 22, 2026
38a10dd
Compare without reporting errors before reporting them
jakebailey Nov 17, 2026
07ad4ef
Add a test for this in a getter of an object literal with a spread
jakebailey Nov 22, 2026
f03b5ae
Add a test for references to a late-bound member in two query orders
jakebailey Nov 26, 2026
4ee42a3
Make checker results deterministic
jakebailey Nov 23, 2026
df72665
Do not report nonexistent properties where errors are never shown
jakebailey Nov 9, 2026
09eed23
Do not blame a use for the circular constraint of a declaration
jakebailey Oct 22, 2026
eb45f41
Resolve mapped type constraints whenever the mapped type is requested
jakebailey Oct 22, 2026
de9821b
Resolve return type cycles as if entered at their first member
jakebailey Nov 23, 2026
ee73974
Name an instantiation cycle from its first declared type
jakebailey Nov 1, 2026
74e1187
Discard results computed from a binding pattern's own elements
jakebailey Nov 2, 2026
ab4b8fa
Keep the result of a resolution nested in a hidden one of itself
jakebailey Nov 22, 2026
71330dd
Keep results a cycle yield computes from scratch
jakebailey Nov 22, 2026
19a963d
Record per-node check facts eagerly instead of as effects
jakebailey Nov 5, 2026
94a9272
Clear a call's resolving marker when discarding its preemptive result
jakebailey Nov 7, 2026
2de1b8e
Discard results cached by signature help
jakebailey Nov 7, 2026
d7f404d
Check that checkers are at rest between requests
jakebailey Nov 8, 2026
2599384
Hold a check's effects during variance cycles instead of recording them
jakebailey Nov 10, 2026
f097d34
Count computations in progress instead of indexing them
jakebailey Nov 10, 2026
2c16173
Track memo map entries in progress with the other computations
jakebailey Nov 10, 2026
0399f4c
Remove an unused memo map accessor
jakebailey Nov 11, 2026
faad659
Keep finding and marking computations in progress cheap when deeply n…
jakebailey Nov 12, 2026
fbde48e
Stop only runaway instantiations at the limit on the instantiation stack
jakebailey Nov 12, 2026
746aa4b
Let a cycle yielding to a member table see the table's computation
jakebailey Nov 12, 2026
1c7e224
Only fail a cycle yield on reading a published member table
jakebailey Nov 12, 2026
f044565
Hide memoized computations in progress from variance measurements
jakebailey Nov 24, 2026
f6f4831
Do not suggest typeof for a name used in its own value's declaration
jakebailey Nov 12, 2026
f0da134
Fail only one computation's instantiations at the stack limit
jakebailey Nov 13, 2026
f41460c
Share heights and key hashing between memoized computations
jakebailey Nov 13, 2026
636f6cc
Count relation complexity as though nothing were cached
jakebailey Nov 16, 2026
0767750
Resolve base type cycles as if entered at their first member
jakebailey Nov 16, 2026
e0e34d5
Account for re-entering declared members in progress
jakebailey Nov 17, 2026
b8b607e
Report an error once for nested type nodes that start together
jakebailey Nov 17, 2026
787ba98
Look for pending effects only in results that may have them
jakebailey Nov 23, 2026
053e65a
Steal files between checkers when checking
jakebailey Nov 6, 2026
0106fec
Choose the checker count from CPUs and program size
jakebailey Nov 6, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 1 addition & 2 deletions packages/typescript/enums/objectFlags.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@ export declare enum ObjectFlags {
ContainsSpread = 1 << 22,
ObjectRestType = 1 << 23,
IsClassInstanceClone = 1 << 26,
IdenticalBaseTypeCalculated = 1 << 27,
IdenticalBaseTypeExists = 1 << 28,
FromTypeNode = 1 << 29,
IsGenericTypeComputed = 1 << 22,
IsGenericObjectType = 1 << 23,
IsGenericIndexType = 1 << 24,
Expand All @@ -49,4 +47,5 @@ export declare enum ObjectFlags {
IsNeverIntersectionComputed = 1 << 25,
IsNeverIntersection = 1 << 26,
IsConstrainedTypeVariable = 1 << 27,
ConditionalForConstraint = 1 << 30,
}
3 changes: 1 addition & 2 deletions packages/typescript/enums/objectFlags.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@ export var ObjectFlags;
ObjectFlags[ObjectFlags["ContainsSpread"] = 4194304] = "ContainsSpread";
ObjectFlags[ObjectFlags["ObjectRestType"] = 8388608] = "ObjectRestType";
ObjectFlags[ObjectFlags["IsClassInstanceClone"] = 67108864] = "IsClassInstanceClone";
ObjectFlags[ObjectFlags["IdenticalBaseTypeCalculated"] = 134217728] = "IdenticalBaseTypeCalculated";
ObjectFlags[ObjectFlags["IdenticalBaseTypeExists"] = 268435456] = "IdenticalBaseTypeExists";
ObjectFlags[ObjectFlags["FromTypeNode"] = 536870912] = "FromTypeNode";
ObjectFlags[ObjectFlags["IsGenericTypeComputed"] = 4194304] = "IsGenericTypeComputed";
ObjectFlags[ObjectFlags["IsGenericObjectType"] = 8388608] = "IsGenericObjectType";
ObjectFlags[ObjectFlags["IsGenericIndexType"] = 16777216] = "IsGenericIndexType";
Expand All @@ -49,4 +47,5 @@ export var ObjectFlags;
ObjectFlags[ObjectFlags["IsNeverIntersectionComputed"] = 33554432] = "IsNeverIntersectionComputed";
ObjectFlags[ObjectFlags["IsNeverIntersection"] = 67108864] = "IsNeverIntersection";
ObjectFlags[ObjectFlags["IsConstrainedTypeVariable"] = 134217728] = "IsConstrainedTypeVariable";
ObjectFlags[ObjectFlags["ConditionalForConstraint"] = 1073741824] = "ConditionalForConstraint";
})(ObjectFlags || (ObjectFlags = {}));
2 changes: 1 addition & 1 deletion tools/scripts/tsc/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1697,7 +1697,7 @@ export const options: OptionsModel = {
group: "commonOptionsWithBuild",
category: diagnostic("Command-line Options"),
description: diagnostic("Set the number of checkers per project."),
defaultValueDescription: diagnostic("4, unless --singleThreaded is passed."),
defaultValueDescription: diagnostic("Based on the available CPUs and the size of the project, unless --singleThreaded is passed."),
minValue: 1,
},
},
Expand Down
3 changes: 1 addition & 2 deletions tsc/internal/api/enum_values_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 30 additions & 10 deletions tsc/internal/api/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -345,12 +345,10 @@ func (sd *snapshotData) newTypeResponse(projectID project.Handle, t *checker.Typ
resp.AliasSymbol = newSymbolReference(t.Alias().Symbol())
}
if t.ObjectFlags()&checker.ObjectFlagsMapped != 0 {
mapped := t.AsMappedType()
mapped.ResolveComponents(c, t)
resp.TypeParameter = sd.registerType(projectID, mapped.TypeParameter())
resp.ConstraintType = sd.registerType(projectID, mapped.ConstraintType())
resp.NameType = sd.registerType(projectID, mapped.NameType())
resp.TemplateType = sd.registerType(projectID, mapped.TemplateType())
resp.TypeParameter = sd.registerType(projectID, c.GetTypeParameterOfMappedType(t))
resp.ConstraintType = sd.registerType(projectID, c.GetConstraintTypeOfMappedType(t))
resp.NameType = sd.registerType(projectID, c.GetNameTypeOfMappedType(t))
resp.TemplateType = sd.registerType(projectID, c.GetTemplateTypeOfMappedType(t))
}
if checker.IsTupleTypeTarget(t) {
elementInfos := t.AsTupleType().ElementInfos()
Expand Down Expand Up @@ -3380,20 +3378,20 @@ func (s *Session) handleGetConstraintOfType(ctx context.Context, params *GetType
}

func (s *Session) handleGetTypeParameterOfMappedType(ctx context.Context, params *GetTypePropertyParams) (*TypeResponse, error) {
return s.resolveTypePropertyOfType(ctx, params, func(t *checker.Type) *checker.Type { return t.AsMappedType().TypeParameter() })
return s.resolveTypePropertyOfTypeWithChecker(ctx, params, (*checker.Checker).GetTypeParameterOfMappedType)
}

func (s *Session) handleGetConstraintTypeOfMappedType(ctx context.Context, params *GetTypePropertyParams) (*TypeResponse, error) {
return s.resolveTypePropertyOfType(ctx, params, func(t *checker.Type) *checker.Type { return t.AsMappedType().ConstraintType() })
return s.resolveTypePropertyOfTypeWithChecker(ctx, params, (*checker.Checker).GetConstraintTypeOfMappedType)
}

// @gen-proto-nullable
func (s *Session) handleGetNameTypeOfMappedType(ctx context.Context, params *GetTypePropertyParams) (*TypeResponse, error) {
return s.resolveTypePropertyOfType(ctx, params, func(t *checker.Type) *checker.Type { return t.AsMappedType().NameType() })
return s.resolveTypePropertyOfTypeWithChecker(ctx, params, (*checker.Checker).GetNameTypeOfMappedType)
}

func (s *Session) handleGetTemplateTypeOfMappedType(ctx context.Context, params *GetTypePropertyParams) (*TypeResponse, error) {
return s.resolveTypePropertyOfType(ctx, params, func(t *checker.Type) *checker.Type { return t.AsMappedType().TemplateType() })
return s.resolveTypePropertyOfTypeWithChecker(ctx, params, (*checker.Checker).GetTemplateTypeOfMappedType)
}

// @gen-proto-nullable
Expand Down Expand Up @@ -3574,6 +3572,28 @@ func (s *Session) resolveTypePropertyOfType(ctx context.Context, params *GetType
return setup.sd.newTypeResponse(setup.projectID, result, setup.checker), nil
}

// resolveTypePropertyOfTypeWithChecker is resolveTypePropertyOfType for a
// property the checker computes.
func (s *Session) resolveTypePropertyOfTypeWithChecker(ctx context.Context, params *GetTypePropertyParams, getter func(*checker.Checker, *checker.Type) *checker.Type) (*TypeResponse, error) {
setup, err := s.setupChecker(ctx, params.Snapshot, params.Project)
if err != nil {
return nil, err
}
defer setup.done()

t, err := setup.sd.resolveTypeHandle(params.Project, params.Type)
if err != nil {
return nil, err
}

result := getter(setup.checker, t)
if result == nil {
return nil, nil
}

return setup.sd.newTypeResponse(setup.projectID, result, setup.checker), nil
}

// resolveTypeArrayPropertyOfType resolves a type property of an array of types and returns an array of type responses.
func (s *Session) resolveTypeArrayPropertyOfType(ctx context.Context, params *GetTypePropertyParams, getter func(*checker.Type) []*checker.Type) ([]*TypeResponse, error) {
setup, err := s.setupChecker(ctx, params.Snapshot, params.Project)
Expand Down
5 changes: 5 additions & 0 deletions tsc/internal/ast/symbol.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,11 @@ func (m *SymbolMap) SymbolAt(i int) *Symbol {
return symbol
}

// At returns the name and symbol of the i-th entry, in insertion order.
func (m *SymbolMap) At(i int) (string, *Symbol) {
return m.KeyAt(i), m.SymbolAt(i)
}

func (m *SymbolMap) Find(key string) int {
if m == nil {
return -1
Expand Down
10 changes: 10 additions & 0 deletions tsc/internal/ast/utilities.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,16 @@ func GetNodeId(node *Node) NodeId {
return NodeId(id)
}

// PeekNodeId returns the id of node, or 0 if it has none yet.
func PeekNodeId(node *Node) NodeId {
return NodeId(node.id.Load())
}

// PeekSymbolId returns the id of symbol, or 0 if it has none yet.
func PeekSymbolId(symbol *Symbol) SymbolId {
return SymbolId(symbol.id.Load())
}

func GetSymbolId(symbol *Symbol) SymbolId {
id := symbol.id.Load()
if id == 0 {
Expand Down
Loading
Loading