@hyperfrontend/project-scope/tech/typestypes
Type-system detectors covering the typing approaches found in JavaScript codebases.
Covers TypeScript, Flow, and JSDoc-typed JavaScript. typescriptDetector, flowDetector, and jsdocDetector each follow the shared TypeSystemDetector contract; detectTypeSystems runs them all and returns the aggregate TypeSystemDetection[]. Allows downstream tooling to make type-system-aware decisions without hard-coding "if tsconfig.json exists" checks.
API Reference
ƒ Functions
Detect all type systems in project.
Parameters
Returns
TypeSystemDetection[]Array of detected type systems, sorted by confidence
Example
Detecting all type systems
import { detectTypeSystems } from '@hyperfrontend/project-scope'
const typeSystems = detectTypeSystems('./my-project')
// => [
// { id: 'typescript', name: 'TypeScript', version: '5.3.0', strictMode: true, confidence: 95, ... },
// { id: 'jsdoc', name: 'JSDoc', confidence: 40, ... }
// ]
const primary = typeSystems[0]?.name ?? 'None'
console.log(`Primary type system: ${primary}`)Detect Flow in project.
Parameters
Returns
TypeSystemDetectionDetection result or null if not detected
Example
Detecting Flow type system
import { flowDetector } from '@hyperfrontend/project-scope'
const result = flowDetector('./my-project')
if (result) {
console.log(`Flow ${result.version} with config: ${result.configPath}`)
// => "Flow 0.232.0 with config: .flowconfig"
}Detect JSDoc type annotations in project.
Parameters
Returns
TypeSystemDetectionDetection result or null if not detected
Example
Detecting JSDoc type annotations
import { jsdocDetector } from '@hyperfrontend/project-scope'
const result = jsdocDetector('./my-project')
if (result) {
console.log('JSDoc types detected')
console.log('Sources:', result.detectedFrom.map(s => s.path ?? s.field))
// => "Sources: ['jsconfig.json', 'src/utils.js (JSDoc annotations)']"
}Detect TypeScript in project.
Parameters
Returns
TypeSystemDetectionDetection result or null if not detected
Example
Detecting TypeScript
import { typescriptDetector } from '@hyperfrontend/project-scope'
const result = typescriptDetector('./my-project')
if (result) {
console.log(`TypeScript ${result.version}`)
console.log(`Strict mode: ${result.strictMode ?? 'unknown'}`)
// => "TypeScript 5.3.0"
// => "Strict mode: true"
}◈ Interfaces
Type system detection result.
Properties
● Variables
All type system detectors