A Go-based bridge to the TypeScript compiler, with XCFramework distribution for Swift applications.
This repository builds the native TypeScript compiler bridge and distributes it as an XCFramework. For using this in Swift projects, see typescript-go-swift.
- ✅ Native TypeScript Compilation: Go bridge to TypeScript compiler with C API
- ✅ XCFramework Distribution: Pre-built binaries for iOS and macOS (arm64 + x86_64)
- ✅ Rich Diagnostics: Detailed error information with file locations and error codes
- ✅ Cross-Platform: Supports iOS (device + simulator) and macOS (Apple Silicon + Intel)
- ✅ Swift Package: Clean Swift API through typescript-go-swift
Add the Swift package to your project:
dependencies: [
.package(url: "https://github.com/zshannon/typescript-go-swift.git", from: "0.1.2")
]
See typescript-go-swift for full Swift API documentation and usage examples.
typescript-go (this repo)
├── bridge/ # Go bridge to TypeScript compiler
├── Sources/TSCBridge/ # C headers and module map
├── scripts/ # Build scripts for XCFramework
└── swift-package/ # Submodule → typescript-go-swift
└── Sources/
├── SwiftTSGo/ # Swift API wrapper
└── TSCBridge/ # C headers (copy)
- For using the Swift package: iOS 18.0+ / macOS 15.0+, Swift 6.1+, Xcode 16.0+
- For building from source: Go 1.25+, CGO support, Xcode command line tools
To build the XCFramework from source:
./scripts/build-xcframework.sh
This creates release/TSCBridge.xcframework.zip
with binaries for:
- iOS device (arm64)
- iOS simulator (arm64 + x86_64)
- macOS (arm64 + x86_64)
Run the Go bridge tests:
make test-go
Run the Swift tests (uses submodule Swift sources):
make test-swift
bridge/
- Go bridge code interfacing with TypeScript compilerSources/TSCBridge/
- C headers and module map for the bridgescripts/
- Build scripts for creating the XCFrameworkswift-package/
- Git submodule pointing to typescript-go-swiftTests/SwiftTSGoTests/
- Swift test suite
- Build XCFramework: Run the Release XCFramework workflow with version (e.g.,
0.1.3
) - Review generated PR on typescript-go-swift repo
- Merge PR to publish release
The workflow automatically:
- Builds XCFramework for all platforms
- Creates draft release on typescript-go-swift with binary
- Updates Package.swift with new version and checksum
- Creates PR for review
Apache 2.0