Skip to content

Commit 3113467

Browse files
authored
Merge pull request #558 from stepchowfun/typescript-import-extension-default
Make TypeScript import extensions configurable
2 parents 2b45d34 + a3a35c2 commit 3113467

37 files changed

Lines changed: 164 additions & 68 deletions

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [0.16.0] - 2026-07-09
9+
10+
### Added
11+
- The `generate` subcommand now accepts `--typescript-import-extension` to configure relative import specifiers in generated TypeScript code.
12+
13+
### Changed
14+
- The TypeScript generator now emits `.ts` import specifiers by default.
15+
816
## [0.15.0] - 2026-04-22
917

1018
### Changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "typical"
3-
version = "0.15.0"
3+
version = "0.16.0"
44
authors = ["Stephan Boyer <stephan@stephanboyer.com>"]
55
edition = "2024"
66
description = "Data interchange with algebraic data types."

README.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -697,11 +697,16 @@ Arguments:
697697
<SCHEMA_PATH> Set the path to the schema
698698
699699
Options:
700-
--list-schemas List the schemas imported by the given schema (and the given schema
701-
itself)
702-
--rust-file <PATH> Set the path to the Rust file to emit
703-
--typescript-dir <PATH> Set the directory in which the TypeScript files will be emitted
704-
-h, --help Print help
700+
--list-schemas
701+
List the schemas imported by the given schema (and the given schema itself)
702+
--rust-file <PATH>
703+
Set the path to the Rust file to emit
704+
--typescript-dir <PATH>
705+
Set the directory in which the TypeScript files will be emitted
706+
--typescript-import-extension <EXTENSION>
707+
Set the extension to use in TypeScript import specifiers [default: .ts]
708+
-h, --help
709+
Print help
705710
```
706711

707712
## Installation instructions

benchmarks/typescript/package-lock.json

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

benchmarks/typescript/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"name": "benchmark",
33
"version": "1.0.0",
4+
"type": "module",
45
"scripts": {
56
"main": "npm run typical && rm -rf dist && tsc --project tsconfig.json && node dist/src/main.js",
67
"lint": "npm run typical && vp check",

benchmarks/typescript/src/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// oxlint-disable no-console -- The benchmark reports measurements to stdout.
22
import { hrtime } from 'node:process';
3-
import { Message, Struct } from '../generated/types';
3+
import { Message, Struct } from '../generated/types.ts';
44

55
const pathologicalIterations = 5_000;
66
const massiveStringSize = 500_000_000;

benchmarks/typescript/tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"types": ["node"],
88
"erasableSyntaxOnly": true,
99
"noFallthroughCasesInSwitch": true,
10+
"rewriteRelativeImportExtensions": true,
1011
"skipLibCheck": true,
1112
"strict": true
1213
},

examples/typescript/package-lock.json

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/typescript/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"name": "example",
33
"version": "1.0.0",
4+
"type": "module",
45
"scripts": {
56
"main": "npm run typical && rm -rf dist && tsc --project tsconfig.json && node dist/src/main.js",
67
"lint": "npm run typical && vp check",

0 commit comments

Comments
 (0)