You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add batched assignability checks into the Checker API #63873
// existingisTypeAssignableTo(source: Type,target: Type): boolean;// batched - one result per pair, in orderareTypesAssignableTo(pairs: readonly(readonly[source: Type,target: Type])[]): boolean[];// sugar for the two common shapesareTypesAssignableTo(sources: readonlyType[],target: Type): boolean[];areTypesAssignableTo(source: Type,targets: readonlyType[]): boolean[];// short-circuiting quantifiers - one boolean, server stops earlyisAnyTypeAssignableTo(sources: readonlyType[],target: Type): boolean;areAllTypesAssignableTo(sources: readonlyType[],target: Type): boolean;
isTypeAssignableTo answers one pair per call, but in my use-case I usually have more than one pair to check.
What I actually do is match a type against a list of candidate types and take the ones that fit,
so a single run is candidates × requests checks. In my case - there could be thousands of such checks.
The API already batches like this in other places, getSymbolAtPosition, getSymbolAtLocation, getTypeAtLocation and getTypeOfSymbol all take arrays.
The short-circuiting quantifiers are also nice to have, but I understand that it complicates an api and I'm not sure it's really worth to have them since checker is already blazingly fast 😄
I've also prototyped the whole thing locally (Apple M4 Max, macOS 26.5.2, node v24.11.1, main@322fa1ecd):
1000 pairs cost 8.8 ms as 1000 sync calls versus 0.17 ms in one batched call, and 55 ms versus 0.24 ms on the async API.
Activity
weswigham commentedon Sep 2, 2026
Since #63937 and #64023 you should be able to batch up whatever API calls you want - that work well for you?
artem1458 commentedon Sep 8, 2026
Wesley Wigham (@weswigham) It completely solves my use-case, thanks!