Skip to content

[@typescript/api] Batch of Checker and Type APIs#2831

Draft
andrewbranch wants to merge 2 commits intomicrosoft:mainfrom
andrewbranch:api-surface-area
Draft

[@typescript/api] Batch of Checker and Type APIs#2831
andrewbranch wants to merge 2 commits intomicrosoft:mainfrom
andrewbranch:api-surface-area

Conversation

@andrewbranch
Copy link
Member

Checker query methods:

  • getDeclaredTypeOfSymbol
  • getTypeAtLocation / getTypeAtLocations
  • getTypeAtPosition / getTypesAtPositions
  • getSignaturesOfType
  • getContextualType
  • getBaseTypeOfLiteralType
  • getShorthandAssignmentValueSymbol
  • getTypeOfSymbolAtLocation

Intrinsic type getters:

  • getAnyType, getStringType, getNumberType, getBooleanType, getVoidType, getUndefinedType, getNullType, getNeverType, getUnknownType, getBigIntType, getESSymbolType

Symbol property fetchers:

  • getMembers, getExports, getParent

Type hierarchy:

  • Type — base type (id, flags, getSymbol())
    • LiteralType — string/number/bigint/boolean literals (value)
    • ObjectType — object types (objectFlags)
      • TypeReference — e.g. Array<string> (getTarget())
        • InterfaceType — classes and interfaces (getTypeParameters(), getOuterTypeParameters(), getLocalTypeParameters())
          • TupleType — tuple types (elementFlags, fixedLength, readonly)
    • UnionOrIntersectionType — (getTypes())
      • UnionType
      • IntersectionType
    • TypeParameter
    • IndexTypekeyof T (getTarget())
    • IndexedAccessTypeT[K] (getObjectType(), getIndexType())
    • ConditionalTypeT extends U ? X : Y (getCheckType(), getExtendsType())
    • SubstitutionType — (getBaseType(), getConstraint())
    • TemplateLiteralType — template literals (texts, getTypes())
    • StringMappingTypeUppercase<T> etc. (getTarget())

New enums/flags exposed:

  • ObjectFlags, ElementFlags, SignatureFlags, SignatureKind

- Add Symbol methods: getParent, getMembers, getExports
- Add Type method: getSymbol
- Add Signature type with flags, declaration, parameters, target
- Add Checker methods: getSignaturesOfType, getTypeAtLocation, getTypeAtPosition
- Add SignatureKind and SignatureFlags enums (.enum.ts pattern)
- Fix RemoteSourceFile.id to use node handle format (pos.end.kind.path)
- Remove unused base64 node id from binary encoder
- Fix GetSymbolAtLocation to handle SourceFile nodes (remove early parent check)
- Add comprehensive sync and async client tests
- Add 11 type sub-property endpoints (getTargetOfType, getTypesOfType,
  getTypeParametersOfType, etc.) to Go server and TS client
- Add getDeclaredTypeOfSymbol endpoint for retrieving declared types of
  type alias symbols (vs getTypeOfSymbol which returns value types)
- Add fetchType/fetchTypes helpers to TypeObject for lazy resolution of
  type handles with local cache support via ObjectRegistry.tryGetType
- Remove handle-typed properties from public type interfaces, keeping
  handles as wire-format fields for client-side cache optimization
- Rename tupleReadonly to readonly across Go JSON tags and TS interfaces
- Add comprehensive tests for all type sub-property fetchers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments