Skip to content

feat: Add support for typescript lang#46

Merged
abhisek merged 2 commits intomainfrom
feat/add-typescript-lang-support
Feb 24, 2026
Merged

feat: Add support for typescript lang#46
abhisek merged 2 commits intomainfrom
feat/add-typescript-lang-support

Conversation

@abhisek
Copy link
Copy Markdown
Member

@abhisek abhisek commented Feb 24, 2026

No description provided.

@abhisek abhisek requested a review from a team February 24, 2026 14:25
@safedep
Copy link
Copy Markdown

safedep bot commented Feb 24, 2026

SafeDep Report Summary

Green Malicious Packages Badge Green Vulnerable Packages Badge Green Risky License Badge

No dependency changes detected. Nothing to scan.

This report is generated by SafeDep Github App

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Feb 24, 2026

Codecov Report

❌ Patch coverage is 75.94752% with 165 lines in your changes missing coverage. Please review.
✅ Project coverage is 62.85%. Comparing base (aa08f82) to head (7d2d607).

Files with missing lines Patch % Lines
lang/ecmascript_resolvers.go 70.00% 68 Missing and 28 partials ⚠️
lang/typescript_resolvers.go 79.19% 37 Missing and 25 partials ⚠️
plugin/depsusage/ignore.go 72.22% 5 Missing ⚠️
plugin/callgraph/processors.go 92.85% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #46      +/-   ##
==========================================
+ Coverage   61.26%   62.85%   +1.58%     
==========================================
  Files          47       50       +3     
  Lines        4123     4501     +378     
==========================================
+ Hits         2526     2829     +303     
- Misses       1317     1365      +48     
- Partials      280      307      +27     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds first-class TypeScript support to the code analysis framework (language detection/parsing + resolvers) and enables existing plugins (callgraph, depsusage, stripcomments) to operate on TypeScript sources.

Changes:

  • Introduce a new typescript language implementation backed by the tree-sitter TSX grammar plus TypeScript-specific resolvers for classes/inheritance/abstract methods.
  • Refactor JavaScript resolvers to reuse shared ECMAScript resolver helpers (imports + functions) and add shared resolver module (ecmascript_resolvers.go).
  • Extend multiple plugins (callgraph, depsusage, stripcomments) to include TypeScript in supported languages, plus TS fixtures/tests and updated callgraph expectations.

Reviewed changes

Copilot reviewed 29 out of 29 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
plugin/stripcomments/stripcomments.go Add TypeScript to StripCommentsPlugin supported languages.
plugin/stripcomments/checks.go Treat TypeScript comment nodes like JavaScript comment nodes.
plugin/depsusage/packagehint.go Reuse JavaScript package-hint logic for TypeScript modules.
plugin/depsusage/ignore.go Add TypeScript-specific ignore rules and refactor require() ignore logic into a helper.
plugin/depsusage/depsusage.go Add TypeScript to depsusage plugin supported languages.
plugin/callgraph/processors.go Add TS-specific node processor mappings and accept TS/JS argument node variants.
plugin/callgraph/plugin_test.go Update JS callgraph expectations to include resolved call arguments.
plugin/callgraph/plugin.go Add TypeScript to callgraph plugin supported languages.
plugin/callgraph/imports.go Add TypeScript module separator handling (same as JS).
plugin/callgraph/callgraph.go Include TS abstract class nodes as DFS sources.
plugin/callgraph/builtins.json Add TypeScript built-in identifiers list.
lang/typescript.go New TypeScript language implementation using TSX grammar and TS resolvers.
lang/typescript_resolvers.go New TypeScript resolvers: imports/functions + classes/inheritance/abstract methods.
lang/typescript_test.go Unit tests for TypeScript language metadata.
lang/typescript_resolvers_test.go Resolver tests for TS imports and function extraction fixtures.
lang/typescript_class_integration_test.go Integration tests for TS class/inheritance resolution using fixtures.
lang/javascript_resolvers.go Replace duplicated JS resolver logic with shared ECMAScript helpers.
lang/ecmascript_resolvers.go New shared ECMAScript resolver helpers for JS/TS (imports + functions).
lang/factory.go Register LanguageCodeTypescript in the language factory.
lang/fixtures/ts_simple_classes.ts TS fixture for class/interface/enum/decorators coverage.
lang/fixtures/ts_class_hierarchy.ts TS fixture for inheritance + implements + abstract class coverage.
lang/fixtures/imports.ts TS fixture for ES imports + type-only imports + require().
lang/fixtures/functions.ts TS fixture for typed functions, classes, abstract methods, decorators.
examples/plugin/main.go Add TypeScript to example plugin supported languages.
examples/plugin/callgraph/fixtures/testFunctions.ts Example TS callgraph fixture (functions/scopes/assignments).
examples/plugin/callgraph/fixtures/testClasses.ts Example TS callgraph fixture (interfaces/classes/super calls).
examples/plugin/callgraph/fixtures/testClass.ts Example TS callgraph fixture (constructors/this/union types).
examples/plugin/callgraph/fixtures/testArgs.ts Example TS callgraph fixture for argument parsing.
core/language.go Add LanguageCodeTypescript constant.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@abhisek abhisek merged commit 3200512 into main Feb 24, 2026
6 checks passed
@abhisek abhisek deleted the feat/add-typescript-lang-support branch February 24, 2026 16:34
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.

4 participants