TypeScript
Last verified end to end: 2026-07-14 (
query_codeschema version 2).
For exact inbound and outbound symbol edges, proof tiers, and adapter-specific caveats, see Reference Traversal.
TypeScript shares JavaScript’s structural adapter and adds interface, enum, abstract-class, type-alias, type-identifier, decorator, and TSX grammar shapes.
Fixtures
Section titled “Fixtures”function Route(path: string) { return (_target: unknown, _key: string) => path;}
interface User { id: UserId;}
enum State { Ready,}
abstract class BaseService {}type UserId = string;
class Service extends BaseService { constructor() { super(); }
@Route("/save") save(value: string): string { return value; }}
export const service = new Service();export const View = () => ( <button onClick={() => service.save("tsx")}>Save</button>);TypeScript-Only Declarations
Section titled “TypeScript-Only Declarations”A type alias is a normalized declaration; interfaces, enums, and abstract classes are normalized as class.
(language typescript (declaration :name "UserId")){"languages":["typescript"],"match":{"kind":"declaration","name":"UserId"}}{ "results": [ { "result_type": "structural_match", "path": "typescript/service.ts", "language": "typescript", "kind": "declaration", "start_line": 14, "end_line": 14, "text": "type UserId = string;", "enclosing_symbol": "service.ts.UserId" } ], "truncated": false}(language typescript (class (name/regex "^(User|State|BaseService)$"))){ "languages": ["typescript"], "match": { "kind": "class", "name": {"regex": "^(User|State|BaseService)$"} }}{ "results": [ {"result_type":"structural_match","path":"typescript/service.ts","language":"typescript","kind":"class","start_line":5,"end_line":7,"text":"interface User {…","enclosing_symbol":"User"}, {"result_type":"structural_match","path":"typescript/service.ts","language":"typescript","kind":"class","start_line":9,"end_line":11,"text":"enum State {…","enclosing_symbol":"State"}, {"result_type":"structural_match","path":"typescript/service.ts","language":"typescript","kind":"class","start_line":13,"end_line":13,"text":"abstract class BaseService {}","enclosing_symbol":"BaseService"} ], "truncated": false}Exclude Constructors And Lambdas
Section titled “Exclude Constructors And Lambdas”callable includes functions, methods, constructors, and lambdas. not_kind keeps only the named save method, and the decorator constraint proves its annotation mapping.
(callable :name "save" (not-kind [constructor lambda]) :decorators [(decorator :name "Route" :capture "route")]){ "match": { "kind": "callable", "name": "save", "not_kind": ["constructor", "lambda"], "decorators": [ {"kind": "decorator", "name": "Route", "capture": "route"} ] }}{ "results": [ { "result_type": "structural_match", "path": "typescript/service.ts", "language": "typescript", "kind": "method", "start_line": 22, "end_line": 24, "text": "save(value: string): string {…", "captures": [ {"name":"route","text":"@Route(\"/save\")","start_line":21} ], "enclosing_symbol": "Service.save" } ], "truncated": false}Scope A Query To TSX
Section titled “Scope A Query To TSX”The TypeScript language filter includes .tsx; where narrows this call to the TSX fixture and excludes the new Service() call in the .ts file.
(where "typescript/**/*.tsx" (language typescript (call :callee "save" :receiver "service" :args [(capture "value")]))){ "where": ["typescript/**/*.tsx"], "languages": ["typescript"], "match": { "kind": "call", "callee": {"name": "save"}, "receiver": {"name": "service"}, "args": [{"capture": "value"}] }}{ "results": [ { "result_type": "structural_match", "path": "typescript/view.tsx", "language": "typescript", "kind": "call", "start_line": 2, "end_line": 2, "text": "service.save(\"tsx\")", "captures": [{"name":"value","text":"\"tsx\"","start_line":2}], "enclosing_symbol": "View" } ], "truncated": false}Precision Boundary
Section titled “Precision Boundary”Interfaces, enums, and abstract classes intentionally share the normalized class kind. Use name, containment, or source/path scoping when their source syntax matters; version 2 has no separate public interface kind.
Traverse Indexed Types And Members
Section titled “Traverse Indexed Types And Members”class QueryRoot { rootMember(): void {}}
class QueryLeaf extends QueryRoot { leafMember(): void {}}(supertypes :transitive true (enclosing-decl (language typescript (class :name "QueryLeaf")))){"languages":["typescript"],"match":{"kind":"class","name":"QueryLeaf"},"steps":[{"op":"enclosing_decl"},{"op":"supertypes","transitive":true}]}{ "results": [ { "end_line": 3, "fq_name": "QueryRoot", "kind": "class", "language": "typescript", "path": "typescript/hierarchy.ts", "provenance": [ { "seed": { "end_line": 7, "kind": "class", "path": "typescript/hierarchy.ts", "result_type": "structural_match", "start_line": 5 }, "steps": [ { "op": "enclosing_decl", "result": { "end_line": 7, "fq_name": "QueryLeaf", "kind": "class", "path": "typescript/hierarchy.ts", "result_type": "declaration", "start_line": 5 } }, { "op": "supertypes", "result": { "end_line": 3, "fq_name": "QueryRoot", "kind": "class", "path": "typescript/hierarchy.ts", "result_type": "declaration", "start_line": 1 } } ] } ], "result_type": "declaration", "signature": "class QueryRoot {", "start_line": 1 } ], "truncated": false}(owner (members (subtypes (enclosing-decl (language typescript (class :name "QueryRoot")))))){"languages":["typescript"],"match":{"kind":"class","name":"QueryRoot"},"steps":[{"op":"enclosing_decl"},{"op":"subtypes"},{"op":"members"},{"op":"owner"}]}{ "results": [ { "end_line": 7, "fq_name": "QueryLeaf", "kind": "class", "language": "typescript", "path": "typescript/hierarchy.ts", "provenance": [ { "seed": { "end_line": 3, "kind": "class", "path": "typescript/hierarchy.ts", "result_type": "structural_match", "start_line": 1 }, "steps": [ { "op": "enclosing_decl", "result": { "end_line": 3, "fq_name": "QueryRoot", "kind": "class", "path": "typescript/hierarchy.ts", "result_type": "declaration", "start_line": 1 } }, { "op": "subtypes", "result": { "end_line": 7, "fq_name": "QueryLeaf", "kind": "class", "path": "typescript/hierarchy.ts", "result_type": "declaration", "start_line": 5 } }, { "op": "members", "result": { "end_line": 6, "fq_name": "QueryLeaf.leafMember", "kind": "function", "path": "typescript/hierarchy.ts", "result_type": "declaration", "start_line": 6 } }, { "op": "owner", "result": { "end_line": 7, "fq_name": "QueryLeaf", "kind": "class", "path": "typescript/hierarchy.ts", "result_type": "declaration", "start_line": 5 } } ] } ], "result_type": "declaration", "signature": "class QueryLeaf extends QueryRoot {", "start_line": 5 } ], "truncated": false}