typescript

package
v0.36.2 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package typescript parses TypeScript source files for code analysis.

Extracts functions, classes, interfaces, and type definitions from .ts and .tsx files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewTypeScriptPlugin

func NewTypeScriptPlugin(logger *slog.Logger) schema.ParserPlugin

NewTypeScriptPlugin creates and initializes a new TypeScript parser that satisfies the ParserPlugin interface.

Types

type Parser

type Parser struct {
	// contains filtered or unexported fields
}

Parser implements the schema.ParserPlugin interface for TypeScript.

func (*Parser) CanHandle

func (p *Parser) CanHandle(path string, info fs.FileInfo) bool

CanHandle determines if the parser can process a given file. It accepts .ts and .tsx files, excluding common test file patterns (*.test.*, *.spec.*).

func (*Parser) Chunk

func (p *Parser) Chunk(content string, path string, opts *schema.CodeChunkingOptions) ([]schema.CodeChunk, error)

Chunk parses TypeScript code and divides it into logical code chunks.

func (*Parser) Extensions

func (p *Parser) Extensions() []string

Extensions returns the file extensions this parser handles.

func (*Parser) ExtractMetadata

func (p *Parser) ExtractMetadata(content string, path string) (schema.FileMetadata, error)

ExtractMetadata parses TypeScript code to extract high-level metadata.

func (*Parser) ExtractUsedSymbols added in v0.15.0

func (p *Parser) ExtractUsedSymbols(content string) []string

ExtractUsedSymbols identifies potential external types/functions being used in the code.

func (*Parser) IsGenerated added in v0.15.0

func (p *Parser) IsGenerated(content string, path string) bool

func (*Parser) Name

func (p *Parser) Name() string

Name returns the name of the parser.

Jump to

Keyboard shortcuts

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