TypeScript / JS
Managed AST since v1.0๐ Catches every TS/JS export including re-exports and barrel files. Skips .d.ts and tests automatically.
.ts.tsx.js.jsx.mts.cts What gets detected
The public surface spec-sync tracks for TypeScript / JS.
- export function/class/interface/type/const/enum
- export default class/function
- export { Name } and export type { Name } re-exports
- export * as Namespace from '...' wildcard namespace
- export * from '...' wildcard resolution (with resolver)
Detection rules
Direct export declarations
Matches export keyword followed by a declaration. Handles async, abstract modifiers.
export function createAuth(config: Config): Auth {}
export class AuthService {}
export interface AuthConfig {}
export type TokenType = string;
export const DEFAULT_TTL = 3600;
export enum AuthStatus { Active, Expired } Default exports
export default class/function with optional name. Keyword-like identifiers (new, true, null) are excluded.
export default class MyApp {}
export default function handler() {} Named re-exports
export { Name, OldName as NewName } and export type { MyType }. Aliases use the target name.
export { Foo, Bar as Baz } from './module';
export type { MyType } from './types'; Wildcard re-exports
export * as Namespace captures the namespace name. export * from '...' resolves via file resolver if provided.
export * as Utils from './utils';
export * from './helpers'; Example: spec & source
The *.spec.md contract on the left,
the TypeScript / JS source it documents on the right. spec-sync matches the two.
Spec (*.spec.md)
---
module: auth
version: 1
status: stable
files:
- src/auth/service.ts
---
## Purpose
Handles JWT authentication.
## Public API
| Function | Parameters | Returns | Description |
|----------|-----------|---------|-------------|
| `authenticate` | `(token: string)` | `User \| null` | Validates bearer token |
| `AuthService` | n/a | n/a | Auth service class |
| `TokenType` | n/a | n/a | Token string type alias |
## Change Log
| Date | Change |
|------|--------|
| 2026-01-01 | Initial | Source
export async function authenticate(token: string): Promise<User | null> {
return verifyJwt(token);
}
export class AuthService {
constructor(private db: Database) {}
}
export type TokenType = string; Test-file patterns
Files matching these are excluded from the detected surface.
| Pattern | Explanation |
|---|---|
**/*.test.ts | Unit test files: auto-excluded |
**/*.spec.ts | Spec test files: auto-excluded |
**/*.d.ts | Type declaration files: skipped (no runtime exports) |
**/*.test.js | JavaScript test files: auto-excluded |
Caveats
- Re-exports from external npm packages are not followed across package boundaries.
- Conditional exports in package.json are not parsed.
- Dynamic re-exports (export default computed) may not be captured.
- Module augmentation (declare module '...') is not detected.