TypeScript Validator
Check one TypeScript or TSX file with pinned compiler diagnostics, target and strictness choices, and explicit project-context limits.{{ summaryTitle }}
{{ summaryLine }}
Outcome
{{ reportSummary }} Source preserved, emit disabled, and no code executed.
Recommended next step
{{ recommendation }}
Compiler context
TypeScript {{ report.compiler_version }} checked one in-memory {{ sourceModeLabel }} file using {{ targetLabel }}, {{ moduleLabel }}, and {{ strictnessLabel }}.
{{ report.context_label }}. DOM, WebWorker, Node.js, framework, package, path-alias, tsconfig inheritance, and remote module declarations are not loaded.
The chart renderer is unavailable. The same category counts remain available in the brief and findings ledger.
| Location | Code | Category | Finding | Next step | Copy |
|---|---|---|---|---|---|
| {{ diagnosticLocation(finding) }} | {{ finding.code }} | {{ finding.category }} | {{ finding.next_step }} | ||
| No compiler diagnostics in this bounded context.Run the same source in its real project to verify dependencies, tsconfig, runtime behavior, lint rules, and framework types. | |||||
Showing the first {{ report.diagnostics.length }} findings. Fix them, then validate again.
A TypeScript snippet does not have one context-independent meaning. The selected ECMAScript target decides which language features and core library declarations are available. Module settings affect how imports and exports are interpreted. Strictness changes which uncertain values and declarations become errors. TSX adds JSX grammar that ordinary TypeScript source does not accept.
Compiler diagnostics are therefore evidence about source plus configuration. A BigInt literal can be valid with an ES2020 target and rejected with ES2018. A parameter without an explicit type can pass relaxed checking and fail under strict checking. Angle-bracket JSX needs TSX mode, while the same characters may describe generics or comparisons in a TypeScript file.
| Context choice | What it changes | Common mistake |
|---|---|---|
| Language target | Accepted syntax transformations and available ECMAScript core declarations | Checking modern code against a newer target than the deployed runtime |
| Module mode | Compiler treatment of ES module or CommonJS syntax | Assuming a single-file check reproduces package and loader behavior |
| Strictness | A group of stronger type-safety checks | Calling relaxed success equivalent to a strict project build |
| Source mode | TypeScript or TSX grammar and the submitted file identity | Using TypeScript mode for JSX or assuming generic JSX names provide framework types |
The compiler also needs declarations for the surrounding environment. Browser APIs come from DOM libraries, Node.js globals come from Node type packages, and frameworks and dependencies contribute their own types. Without those declarations, a single file cannot settle whether an import exists, a component prop is correct, or a runtime global is available.
That limitation is useful when it is explicit. An isolated check can expose syntax and type errors that depend only on the file and selected core library, while reporting imports as missing project context instead of fetching packages or guessing their types. It also leaves the source unchanged and does not emit or execute JavaScript.
The final authority for production code is the real project configuration: its tsconfig.json, package graph, declaration files, module resolution, framework settings, generated types, and build command. Use an isolated report to shorten the first review, then run the project compiler and tests before release.
How to Use This Tool:
Match the oldest runtime and source grammar you actually support before interpreting compiler diagnostics.
- Paste source into Source or load one local
.ts,.tsx,.mts,.cts, or text file. The source must stay within 20 KB and 1,000 lines. - Choose TypeScript for ordinary typed source or TSX with generic JSX names when the file contains JSX. Generic JSX declarations allow intrinsic tag names for syntax and basic type checking; they do not supply React or another framework's types.
- Set Language target to the oldest supported runtime: ES2018, ES2020, ES2022, or ES2025. Then choose ES modules or CommonJS to match the source's intended module form.
- Keep Strict for new code unless the destination project deliberately uses relaxed checking. Showing affected source lines changes only the ledger presentation.
- Fix compiler errors in source order and treat context findings separately. Imports, package types, path aliases, and project references must be checked in the real project rather than repaired as if they were local type errors.
Interpreting Results:
Errors come from the pinned TypeScript compiler under the selected target, module mode, strictness, source mode, and bundled core library. The diagnostic code and source position help connect a message with compiler documentation and the affected expression.
Context findings identify imports, exports from another module, dynamic imports, or require() calls that cannot be resolved in a one-file check. They are not proof that the dependency is missing. They mean the result cannot decide without the destination project's filesystem and configuration.
No diagnostics means no supported compiler or context finding was returned for this isolated setup. It does not prove that the code builds, runs, passes lint or tests, resolves dependencies, matches framework declarations, or behaves securely. Run the project type-check command with its own configuration next.
Technical Details:
The compiler program contains one submitted source file plus bundled ECMAScript core declaration files for the selected target. DOM, WebWorker, Node.js, framework, test-runner, and package declarations are absent. Module resolution is disabled, JavaScript input is not accepted, library declaration checking is skipped, and emission is turned off.
Mechanism Core
| Stage | Mechanism | Observable result |
|---|---|---|
| Bound source | Require non-blank text no longer than 20,000 characters or 1,000 lines. | Input issue before compilation |
| Build context | Select TypeScript or TSX identity, ECMAScript target, ES module or CommonJS mode, strict or relaxed checks, and matching core declarations. | Versioned context label |
| Compile without emit | Collect option, global, syntactic, and semantic diagnostics for the submitted file without writing JavaScript. | Compiler diagnostic code, category, message, and source range |
| Mark unresolved context | Recognize static imports, re-exports, import-equals forms, dynamic imports, and require() calls without resolving them. | Context finding at the module specifier |
| Order and bound | Deduplicate findings, sort by line, character, code, and message, then keep the first 100. | Stable ledger and truncation signal |
Rule Core
The selected controls map to compiler rules rather than post-processing labels. Keeping the mapping explicit explains why the same source can produce a different valid report after one setting changes.
| Choice | Applied rule | Important boundary |
|---|---|---|
| ES2018, ES2020, ES2022, or ES2025 | Sets the compiler target and loads the corresponding bundled ECMAScript core declarations. | No DOM, Node.js, framework, or package declarations are added. |
| ES modules or CommonJS | Sets the compiler module kind to ESNext or CommonJS. | Package metadata and runtime loader rules are not simulated. |
| Strict | Enables the compiler's grouped strict checks. | The exact set belongs to the pinned compiler version and may differ from other releases. |
| Relaxed | Disables the grouped strict option. | Other compiler errors can still occur; relaxed does not mean unchecked. |
| TypeScript | Parses the input as a .ts source file without JSX. | JSX syntax is not accepted. |
| TSX | Parses the input as .tsx, preserves JSX, and supplies generic intrinsic JSX names. | No framework-specific components, props, factories, or runtime are declared. |
Compiler diagnostics for unresolved modules are replaced by a single explicit context finding for each module use. This avoids presenting a failed package lookup as if the browser had inspected the user's project. It also keeps imports inert; no package, alias, or remote module is fetched.
Result counts separate compiler errors, warnings, and context findings. Compiler messages are version-dependent, so comparisons between reviews should keep TypeScript 6.0.3, target, module mode, strictness, and source mode unchanged.
Limitations:
This is a bounded TypeScript 6.0.3 single-file check, not a project build. The result intentionally excludes configuration inheritance, dependency resolution, project references, generated declarations, framework types, filesystem modules, and runtime behavior.
- The source is not formatted, rewritten, emitted, bundled, installed, imported, or executed.
- Only the first 100 ordered diagnostics are retained; fix them and recheck if the result is truncated.
- Pasted or loaded source stays in the current browser tab and is not placed in the shareable page state.
Worked Examples:
BigInt on an older target
With Language target set to ES2018, const value = 1n; reports TS2737 because BigInt literals require ES2020 or later. Raising the target clears that specific diagnostic only when the real runtime also supports the newer target.
Imported project type
A file that imports a package receives a context finding at the module specifier because packages are not resolved. Move the same file into its project and run the configured compiler to decide whether the package, declarations, paths, and module settings are valid.
References:
- TypeScript 6.0.3 release, Microsoft TypeScript, 16 April 2026.
- TSConfig Reference, TypeScript.
- How to configure TypeScript for Node.js, Simplified Guide.