typescript

package
v0.0.0-...-b8e9622 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 30, 2026 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package typescript parses .ts and .tsx source via tree-sitter. We extract symbol-level spans (function, method, class, interface, type alias, enum) — the same shape go/parser produces for Go in internal/parse/golang.

We deliberately do NOT match CKG's tree-sitter query DSL — CKV only needs spans, not full graph extraction, so a recursive descent over named children is simpler and easier to keep in head.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Parser

type Parser struct{}

Parser implements parse.Parser for .ts and .tsx.

func New

func New() *Parser

New returns a stateless TS parser. Tree-sitter parsers themselves are not safe to share across goroutines, but we instantiate a fresh sitter.Parser per Parse() call — see comment inside Parse.

func (*Parser) Language

func (p *Parser) Language() string

func (*Parser) Parse

func (p *Parser) Parse(file string, src []byte) ([]cparse.SymbolSpan, error)

Parse extracts top-level + class-nested symbol spans. ext-driven grammar selection: .tsx uses the TSX grammar so JSX-aware syntax parses without errors.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL