Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions packages/json-schema-typed/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Hidden folders and files
.*
!.gitignore
!.*.example

# Common generated folders
logs/
node_modules/
out/
dist/
dist-ssr/
build/
coverage/
temp/

# Common generated files
*.log
*.log.*
*.tsbuildinfo
*.vitest-temp.json
vite.config.ts.timestamp-*
vitest.config.ts.timestamp-*

# Common manual ignore files
*.local
*.pem
Comment thread
dinwwwh marked this conversation as resolved.
76 changes: 76 additions & 0 deletions packages/json-schema-typed/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<div align="center">
<image align="center" src="https://orpc.unnoq.com/logo.webp" width=280 alt="oRPC logo" />

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The <image> tag is not a standard HTML tag. For better compatibility and correctness, you should use the <img> tag instead. Also, HTML attribute values should ideally be quoted (e.g., width="280").

Suggested change
<image align="center" src="https://orpc.unnoq.com/logo.webp" width=280 alt="oRPC logo" />
<img align="center" src="https://orpc.unnoq.com/logo.webp" width="280" alt="oRPC logo" />

</div>
Comment on lines +1 to +3

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix invalid HTML tag: use instead of .

<image> is not a valid HTML element and won’t render on GitHub. Replace it with <img>.

Apply:

-  <image align="center" src="https://orpc.unnoq.com/logo.webp" width=280 alt="oRPC logo" />
+  <img align="center" src="https://orpc.unnoq.com/logo.webp" width="280" alt="oRPC logo" />
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<div align="center">
<image align="center" src="https://orpc.unnoq.com/logo.webp" width=280 alt="oRPC logo" />
</div>
<div align="center">
<img align="center" src="https://orpc.unnoq.com/logo.webp" width="280" alt="oRPC logo" />
</div>
🤖 Prompt for AI Agents
In packages/json-schema-typed/README.md at lines 1 to 3, replace the invalid
HTML tag <image> with the correct <img> tag to ensure proper rendering on
GitHub. Change <image align="center" src="https://orpc.unnoq.com/logo.webp"
width=280 alt="oRPC logo" /> to <img align="center"
src="https://orpc.unnoq.com/logo.webp" width=280 alt="oRPC logo" />.


<h1></h1>
Comment thread
dinwwwh marked this conversation as resolved.

<div align="center">
<a href="https://codecov.io/gh/unnoq/orpc">
<img alt="codecov" src="https://codecov.io/gh/unnoq/orpc/branch/main/graph/badge.svg">
</a>
<a href="https://www.npmjs.com/package/@orpc/json-schema-typed">
<img alt="weekly downloads" src="https://img.shields.io/npm/dw/%40orpc%2Fjson-schema-typed?logo=npm" />
</a>
<a href="https://github.com/unnoq/orpc/blob/main/LICENSE">
<img alt="MIT License" src="https://img.shields.io/github/license/unnoq/orpc?logo=open-source-initiative" />
</a>
<a href="https://discord.gg/TXEbwRBvQn">
<img alt="Discord" src="https://img.shields.io/discord/1308966753044398161?color=7389D8&label&logo=discord&logoColor=ffffff" />
</a>
</div>

<h3 align="center">Typesafe APIs Made Simple 🪄</h3>

**oRPC is a powerful combination of RPC and OpenAPI**, makes it easy to build APIs that are end-to-end type-safe and adhere to OpenAPI standards

---

## Highlights

- **🔗 End-to-End Type Safety**: Ensure type-safe inputs, outputs, and errors from client to server.
- **📘 First-Class OpenAPI**: Built-in support that fully adheres to the OpenAPI standard.
- **📝 Contract-First Development**: Optionally define your API contract before implementation.
- **⚙️ Framework Integrations**: Seamlessly integrate with TanStack Query (React, Vue, Solid, Svelte, Angular), Pinia Colada, and more.
- **🚀 Server Actions**: Fully compatible with React Server Actions on Next.js, TanStack Start, and other platforms.
- **🔠 Standard Schema Support**: Works out of the box with Zod, Valibot, ArkType, and other schema validators.
- **🗃️ Native Types**: Supports native types like Date, File, Blob, BigInt, URL, and more.
- **⏱️ Lazy Router**: Enhance cold start times with our lazy routing feature.
- **📡 SSE & Streaming**: Enjoy full type-safe support for SSE and streaming.
- **🌍 Multi-Runtime Support**: Fast and lightweight on Cloudflare, Deno, Bun, Node.js, and beyond.
- **🔌 Extendability**: Easily extend functionality with plugins, middleware, and interceptors.
- **🛡️ Reliability**: Well-tested, TypeScript-based, production-ready, and MIT licensed.

## Documentation

You can find the full documentation [here](https://orpc.unnoq.com).

## Packages

- [@orpc/contract](https://www.npmjs.com/package/@orpc/contract): Build your API contract.
- [@orpc/server](https://www.npmjs.com/package/@orpc/server): Build your API or implement API contract.
- [@orpc/client](https://www.npmjs.com/package/@orpc/client): Consume your API on the client with type-safety.
- [@orpc/openapi](https://www.npmjs.com/package/@orpc/openapi): Generate OpenAPI specs and handle OpenAPI requests.
- [@orpc/nest](https://www.npmjs.com/package/@orpc/nest): Deeply integrate oRPC with [NestJS](https://nestjs.com/).
- [@orpc/react](https://www.npmjs.com/package/@orpc/react): Utilities for integrating oRPC with React and React Server Actions.
- [@orpc/tanstack-query](https://www.npmjs.com/package/@orpc/tanstack-query): [TanStack Query](https://tanstack.com/query/latest) integration.
- [@orpc/vue-colada](https://www.npmjs.com/package/@orpc/vue-colada): Integration with [Pinia Colada](https://pinia-colada.esm.dev/).
- [@orpc/hey-api](https://www.npmjs.com/package/@orpc/hey-api): [Hey API](https://heyapi.dev/) integration.
- [@orpc/zod](https://www.npmjs.com/package/@orpc/zod): More schemas that [Zod](https://zod.dev/) doesn't support yet.
- [@orpc/valibot](https://www.npmjs.com/package/@orpc/valibot): OpenAPI spec generation from [Valibot](https://valibot.dev/).
- [@orpc/arktype](https://www.npmjs.com/package/@orpc/arktype): OpenAPI spec generation from [ArkType](https://arktype.io/).

## `@orpc/json-schema-typed`

Re-export of [json-schema-typed](https://www.npmjs.com/package/json-schema-typed) due to the upstream issue [RemyRylan/json-schema-typed#116](https://github.com/RemyRylan/json-schema-typed/issues/116).

## Sponsors

<p align="center">
<a href="https://cdn.jsdelivr.net/gh/unnoq/unnoq/sponsors.svg">
<img src='https://cdn.jsdelivr.net/gh/unnoq/unnoq/sponsors.svg'/>
</a>
</p>

## License

Distributed under the MIT License. See [LICENSE](https://github.com/unnoq/orpc/blob/main/LICENSE) for more information.
7 changes: 7 additions & 0 deletions packages/json-schema-typed/build.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { defineBuildConfig } from 'unbuild'

export default defineBuildConfig({
rollup: {
inlineDependencies: ['json-schema-typed'],
},
})
57 changes: 57 additions & 0 deletions packages/json-schema-typed/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"name": "@orpc/json-schema-typed",
"type": "module",
"version": "0.0.0",
"license": "MIT",
"homepage": "https://orpc.unnoq.com",
"repository": {
"type": "git",
"url": "git+https://github.com/unnoq/orpc.git",
"directory": "packages/json-schema-typed"
},
"keywords": [
"unnoq",
"orpc"
],
"publishConfig": {
"exports": {
".": {
"types": "./dist/index.d.mts",
"import": "./dist/index.mjs",
"default": "./dist/index.mjs"
},
"./draft-07": {
"types": "./dist/draft-07.d.mts",
"import": "./dist/draft-07.mjs",
"default": "./dist/draft-07.mjs"
},
"./draft-2019-09": {
"types": "./dist/draft-2019-09.d.mts",
"import": "./dist/draft-2019-09.mjs",
"default": "./dist/draft-2019-09.mjs"
},
"./draft-2020-12": {
"types": "./dist/draft-2020-12.d.mts",
"import": "./dist/draft-2020-12.mjs",
"default": "./dist/draft-2020-12.mjs"
}
}
},
"exports": {
".": "./src/index.ts",
"./draft-07": "./src/draft-07.ts",
"./draft-2019-09": "./src/draft-2019-09.ts",
"./draft-2020-12": "./src/draft-2020-12.ts"
},
"files": [
"dist"
],
"scripts": {
"build": "unbuild",
"build:watch": "pnpm run build --watch",
"type:check": "tsc -b"
},
"devDependencies": {
"json-schema-typed": "^8.0.1"
}
Comment on lines +49 to +56

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Ensure no runtime dependency on json-schema-typed; add sideEffects and consider typesVersions fallback.

  • Keeping json-schema-typed in devDependencies is correct only if the emitted JS does not import it at runtime (type-only re-exports). Ensure src/* uses export type re-exports where applicable.
  • Add "sideEffects": false to aid tree-shaking.
  • For older TS versions that don’t support exports.types, consider typesVersions to map subpaths to DTS as a fallback.

Proposed updates:

   "scripts": {
     "build": "unbuild",
     "build:watch": "pnpm run build --watch",
     "type:check": "tsc -b"
   },
+  "sideEffects": false,
   "devDependencies": {
     "json-schema-typed": "^8.0.1"
   }

And optionally add for broader TS compatibility:

"typesVersions": {
  "*": {
    "": ["dist/index.d.mts"],
    "draft-07": ["dist/draft-07.d.mts"],
    "draft-2019-09": ["dist/draft-2019-09.d.mts"],
    "draft-2020-12": ["dist/draft-2020-12.d.mts"]
  }
}

Confirm your re-exports are type-only (so JS has no runtime import):

Expected: no matches. If matches exist, convert to export type.


🏁 Script executed:

#!/bin/bash
# Inspect re-exports in the wrapper source: prefer `export type { ... } from 'json-schema-typed'`
rg -n "export\\s+(?!type).*from\\s+['\"]json-schema-typed['\"]" packages/json-schema-typed/src -S

Length of output: 365


🏁 Script executed:

#!/bin/bash
# List any non–type-only re-exports from json-schema-typed in the wrapper source
rg -n "export.*from\s+['\"]json-schema-typed['\"]" packages/json-schema-typed/src -S | grep -v "export type"

Length of output: 190


Refactor runtime export to type-only; add sideEffects & typesVersions

Your wrapper is currently doing a full re-export, which pulls in a runtime import of your devDependency. To avoid shipping a runtime dependency on json-schema-typed, please:

• In packages/json-schema-typed/src/index.ts, replace the runtime export:

- export * from 'json-schema-typed'
+ import type * as JSONSchemaTyped from 'json-schema-typed'
+ export type { JSONSchemaTyped }

(Or, if you’re on TS 4.5+, you can use export type * as JSONSchemaTyped from 'json-schema-typed';.)

• In packages/json-schema-typed/package.json, add:

  "scripts": {
    "build": "unbuild",
    "build:watch": "pnpm run build --watch",
    "type:check": "tsc -b"
  },
+ "sideEffects": false,
  "devDependencies": {
    "json-schema-typed": "^8.0.1"
  },
+ "typesVersions": {
+   "*": {
+     "": ["dist/index.d.mts"],
+     "draft-07": ["dist/draft-07.d.mts"],
+     "draft-2019-09": ["dist/draft-2019-09.d.mts"],
+     "draft-2020-12": ["dist/draft-2020-12.d.mts"]
+   }
+ }

This ensures no runtime import of your devDependency, enables tree-shaking, and provides a fallback for older TS versions.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"scripts": {
"build": "unbuild",
"build:watch": "pnpm run build --watch",
"type:check": "tsc -b"
},
"devDependencies": {
"json-schema-typed": "^8.0.1"
}
"scripts": {
"build": "unbuild",
"build:watch": "pnpm run build --watch",
"type:check": "tsc -b"
},
"sideEffects": false,
"devDependencies": {
"json-schema-typed": "^8.0.1"
},
"typesVersions": {
"*": {
"": ["dist/index.d.mts"],
"draft-07": ["dist/draft-07.d.mts"],
"draft-2019-09": ["dist/draft-2019-09.d.mts"],
"draft-2020-12": ["dist/draft-2020-12.d.mts"]
}
}
🤖 Prompt for AI Agents
In packages/json-schema-typed/package.json around lines 49 to 56, you need to
prevent runtime imports of the devDependency by changing your wrapper export to
a type-only export in packages/json-schema-typed/src/index.ts, using either
`export type * as JSONSchemaTyped from 'json-schema-typed';` if on TS 4.5+, or
an equivalent type-only export. Additionally, update package.json to include the
"sideEffects": false field and add a "typesVersions" mapping to support older
TypeScript versions, ensuring no runtime dependency is shipped and enabling
proper tree-shaking.

}
2 changes: 2 additions & 0 deletions packages/json-schema-typed/src/draft-07.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// eslint-disable-next-line no-restricted-imports
export * from 'json-schema-typed/draft-07'
2 changes: 2 additions & 0 deletions packages/json-schema-typed/src/draft-2019-09.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// eslint-disable-next-line no-restricted-imports
export * from 'json-schema-typed/draft-2019-09'
Comment on lines +1 to +2

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

⚠️ Potential issue

Same here: re-export types only to prevent runtime import of a types-only package

Align with the goal of erasableSyntaxOnly and avoid emitting export * from ... in JS.

-// eslint-disable-next-line no-restricted-imports
-export * from 'json-schema-typed/draft-2019-09'
+// eslint-disable-next-line no-restricted-imports
+export type * from 'json-schema-typed/draft-2019-09'

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In packages/json-schema-typed/src/draft-2019-09.ts at lines 1 to 2, the current
code uses a runtime export statement that imports the entire module, which can
cause unwanted runtime imports of a types-only package. To fix this, change the
export to a types-only re-export by using the `export type` syntax to re-export
only types, preventing any runtime import and aligning with erasableSyntaxOnly
goals.

2 changes: 2 additions & 0 deletions packages/json-schema-typed/src/draft-2020-12.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// eslint-disable-next-line no-restricted-imports
export * from 'json-schema-typed/draft-2020-12'
Comment on lines +1 to +2

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Use type-only re-export to avoid runtime re-export and make erasableSyntaxOnly effective

export * from 'json-schema-typed/...' emits a runtime re-export, which defeats the purpose of erasableSyntaxOnly and can break at runtime since json-schema-typed is types-only. Re-export types only.

-// eslint-disable-next-line no-restricted-imports
-export * from 'json-schema-typed/draft-2020-12'
+// Re-export types only to ensure zero runtime emission.
+// eslint-disable-next-line no-restricted-imports
+export type * from 'json-schema-typed/draft-2020-12'

If your TypeScript version doesn’t support export type *, fall back to named type re-exports (less ideal) or keep a .d.ts shim file for re-exports.


🏁 Script executed:

#!/bin/bash
# Verify TS version supports `export type *` and that the repo pins >=5.5
rg -n --hidden --glob '!**/node_modules/**' '"typescript":\s*".*"' -S package.json

Length of output: 115


🌐 Web query:

Does TypeScript support `export type * from "module"` and from which version?

💡 Result:

TypeScript does not support the syntax export type * from "module" as of August 2025. Instead, only named type re-exports are allowed using export type { ... } from "module", or, since TypeScript 4.5, inline with export { type ... } from "module"[6][7].

Details:

  • Attempting export type * from "module" will result in a compiler error: Only named exports may use export type. You must list each type explicitly, as in export type { Foo, Bar } from "module", rather than using the * wildcard.[6]
  • This is a known limitation in TypeScript: The GitHub discussion in [6] explains that export type * from "module" is not currently supported and suggests using named re-exports.
  • Why isn't it supported? The limitation is due to how TypeScript elides type-only exports from output JavaScript and the differences from runtime exports. Implementing wildcard type-only exports would require additional specification and compiler changes.[6][7]
  • Current alternatives: To re-export all types, you must manually list them, e.g.:
    export type { TypeA, TypeB } from "./module";
    // or with inline type-only exports (since TS 4.5)
    export { type TypeA, type TypeB } from "./module";
  • Type-only export * from "module" (i.e., re-exporting all values and types) is allowed, but this includes runtime exports and does not produce a type-only re-export.[6][7]

Summary table:

Syntax Supported? Version/support details
export type * from "module" No Not supported in any TS as of Aug 2025[6]
export type { Foo } from ... Yes Since TypeScript 3.8[7]
export { type Foo } from ... Yes Since TypeScript 4.5[7]

TypeScript documentation confirms only named type re-exports are supported; wildcard type-only re-exports (export type *) are not currently valid[1][7].

Citations:


Use named type‐only re-exports instead of a wildcard
TypeScript does not support export type * from "…". To avoid emitting a runtime export (which will break when the module only contains types), list the exported types explicitly:

• File: packages/json-schema-typed/src/draft-2020-12.ts
• Lines: 1–2

- // eslint-disable-next-line no-restricted-imports
- export * from 'json-schema-typed/draft-2020-12'
+ // Re-export types only to ensure zero runtime emission.
+ // eslint-disable-next-line no-restricted-imports
+ export type {
+   /* replace with actual names exported by draft-2020-12, for example: */
+   JSONSchema,
+   SchemaOptions,
+   ValidateFunction,
+   /* … */
+ } from 'json-schema-typed/draft-2020-12'

If maintaining the full list of types by hand is too cumbersome, consider a .d.ts shim that re-exports everything in one place.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// eslint-disable-next-line no-restricted-imports
export * from 'json-schema-typed/draft-2020-12'
// Re-export types only to ensure zero runtime emission.
// eslint-disable-next-line no-restricted-imports
export type {
/* replace with actual names exported by draft-2020-12, for example: */
JSONSchema,
SchemaOptions,
ValidateFunction,
/* … */
} from 'json-schema-typed/draft-2020-12'
🤖 Prompt for AI Agents
In packages/json-schema-typed/src/draft-2020-12.ts at lines 1 to 2, replace the
wildcard export with named type-only exports by explicitly listing each type to
avoid emitting runtime exports. If the list of types is large, create a .d.ts
shim file that re-exports all types in one place and import from there to keep
the code maintainable.

2 changes: 2 additions & 0 deletions packages/json-schema-typed/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// eslint-disable-next-line no-restricted-imports
export * from 'json-schema-typed'
Comment on lines +1 to +2

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

⚠️ Potential issue

Type-only re-export to ensure zero JS emission and fix erasableSyntaxOnly behavior

Avoid emitting export * from 'json-schema-typed' at runtime from a types-only package.

-// eslint-disable-next-line no-restricted-imports
-export * from 'json-schema-typed'
+// Re-export types only.
+// eslint-disable-next-line no-restricted-imports
+export type * from 'json-schema-typed'

If export type * isn’t available in your TS version, consider using a .d.ts entrypoint that re-exports from json-schema-typed so it never emits JS.

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In packages/json-schema-typed/src/index.ts at lines 1 to 2, the current export
statement emits JavaScript code at runtime, which is undesirable for a
types-only package. Replace the export with a type-only re-export using `export
type { ... }` syntax if supported by your TypeScript version, or alternatively
create a `.d.ts` declaration file that re-exports the types from
'json-schema-typed' to ensure no JavaScript is emitted.

11 changes: 11 additions & 0 deletions packages/json-schema-typed/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"extends": "../../tsconfig.lib.json",
"include": ["src"],
"exclude": [
"**/*.test.*",
"**/*.test-d.ts",
"**/__tests__/**",
"**/__mocks__/**",
"**/__snapshots__/**"
]
}
Comment on lines +1 to +11

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Make type-only elision explicit to avoid runtime imports (ties to erasableSyntaxOnly).

If the goal is to ensure re-exports are erased at emit time (no runtime import of json-schema-typed), explicitly enabling verbatimModuleSyntax and preserving value imports improves consistency across toolchains. If these are already in ../../tsconfig.lib.json, ignore this.

Apply if not set in the base config:

 {
   "extends": "../../tsconfig.lib.json",
+  "compilerOptions": {
+    // Ensure type-only re-exports are preserved as type and safely erased in JS output.
+    "verbatimModuleSyntax": true,
+    "preserveValueImports": true
+  },
   "include": ["src"],
   "exclude": [
     "**/*.test.*",
     "**/*.test-d.ts",
     "**/__tests__/**",
     "**/__mocks__/**",
     "**/__snapshots__/**"
   ]
 }

To confirm the intended behavior and TS support for your toolchain, please check the compiler option details:


🌐 Web query:

What does the TypeScript compiler option `erasableSyntaxOnly` do and from which TS version is it available?

💡 Result:

The TypeScript compiler option erasableSyntaxOnly ensures that your TypeScript code uses only constructs that can be safely erased—i.e., stripped of type information—without changing its runtime behavior. This is particularly important for environments like Node.js that support running TypeScript files directly by stripping types at runtime; only language features that are purely type-level or whose syntax can be trivially removed from the emitted JavaScript are allowed[1][2][4][10].

When enabled, TypeScript will error on constructs that have runtime semantics and cannot be erased by simple type stripping. This includes, but is not limited to:

  • Enums
  • Namespaces and modules with runtime code
  • Parameter properties in classes (e.g., constructor(public x: number))
  • Non-ECMAScript import/export assignments (e.g., import =, export =)[1][2][4][5][8]

Example of disallowed syntax under erasableSyntaxOnly:

// ❌ Not allowed
enum Direction { Up, Down, Left, Right; }

namespace Container { export const value = 42; }

import Bar = Container.Bar;

class Person { constructor(private name: string, public age: number) {} }

Availability:
The erasableSyntaxOnly option is available starting in TypeScript 5.8; attempting to use it with earlier versions will result in an "Unknown compiler option" error[1][4][5][6][10].

For best results, it is recommended to pair erasableSyntaxOnly with verbatimModuleSyntax when targeting direct execution environments or type-stripping workflows[2][3][4].

Summary Table:

Compiler Option Purpose Available Since
erasableSyntaxOnly Restrict to TypeScript syntax that can be fully erased with no runtime semantics. TypeScript 5.8

Citations:


🏁 Script executed:

#!/bin/bash
# Verify whether the base tsconfig already opts into explicit type-only elision
echo "🔍 Checking tsconfig.lib.json for verbatimModuleSyntax and preserveValueImports…"

if [ -f tsconfig.lib.json ]; then
  rg -n '"verbatimModuleSyntax"' tsconfig.lib.json || echo "❌ verbatimModuleSyntax not found"
  rg -n '"preserveValueImports"' tsconfig.lib.json || echo "❌ preserveValueImports not found"
else
  echo "⚠️ tsconfig.lib.json not found at repo root."
fi

Length of output: 453


Enable explicit type-only elision in your package tsconfig

Your base config (../../tsconfig.lib.json) does not yet enable verbatimModuleSyntax or preserveValueImports, which paired with erasableSyntaxOnly (TS 5.8+) ensures that all type-only exports are fully erased at emit time and no unexpected runtime imports occur. Please update:

• File: packages/json-schema-typed/tsconfig.json

Apply this diff:

 {
   "extends": "../../tsconfig.lib.json",
+  "compilerOptions": {
+    // Ensure type-only exports are emitted as types only and safely erased in JS
+    "verbatimModuleSyntax": true,
+    "preserveValueImports": true
+  },
   "include": ["src"],
   "exclude": [
     "**/*.test.*",
     "**/*.test-d.ts",
     "**/__tests__/**",
     "**/__mocks__/**",
     "**/__snapshots__/**"
   ]
 }

Make sure your project uses TypeScript >= 5.8 to leverage erasableSyntaxOnly workflows.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
{
"extends": "../../tsconfig.lib.json",
"include": ["src"],
"exclude": [
"**/*.test.*",
"**/*.test-d.ts",
"**/__tests__/**",
"**/__mocks__/**",
"**/__snapshots__/**"
]
}
{
"extends": "../../tsconfig.lib.json",
"compilerOptions": {
// Ensure type-only exports are emitted as types only and safely erased in JS
"verbatimModuleSyntax": true,
"preserveValueImports": true
},
"include": ["src"],
"exclude": [
"**/*.test.*",
"**/*.test-d.ts",
"**/__tests__/**",
"**/__mocks__/**",
"**/__snapshots__/**"
]
}
🤖 Prompt for AI Agents
In packages/json-schema-typed/tsconfig.json lines 1 to 11, update the
compilerOptions to enable explicit type-only elision by adding
"verbatimModuleSyntax": true and "preserveValueImports": true alongside
"erasableSyntaxOnly" if applicable. This requires ensuring TypeScript version is
5.8 or higher. Modify the tsconfig to include these options so that type-only
exports are fully erased at emit time, preventing unexpected runtime imports.

4 changes: 2 additions & 2 deletions packages/json-schema/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@
},
"dependencies": {
"@orpc/contract": "workspace:*",
"@orpc/json-schema-typed": "workspace:*",
"@orpc/openapi": "workspace:*",
"@orpc/server": "workspace:*",
"@orpc/shared": "workspace:*",
"json-schema-typed": "^8.0.1"
"@orpc/shared": "workspace:*"
},
"devDependencies": {
"zod": "^4.0.14"
Expand Down
6 changes: 3 additions & 3 deletions packages/json-schema/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable no-restricted-imports */
import type * as Draft07 from 'json-schema-typed/draft-07'
import type * as Draft2019 from 'json-schema-typed/draft-2019-09'
import type * as Draft2020 from 'json-schema-typed/draft-2020-12'
import type * as Draft07 from '@orpc/json-schema-typed/draft-07'
import type * as Draft2019 from '@orpc/json-schema-typed/draft-2019-09'
import type * as Draft2020 from '@orpc/json-schema-typed/draft-2020-12'

export type JsonSchema
= | Draft2020.JSONSchema
Expand Down
3 changes: 2 additions & 1 deletion packages/json-schema/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
{ "path": "../shared" },
{ "path": "../server" },
{ "path": "../openapi" },
{ "path": "../contract" }
{ "path": "../contract" },
{ "path": "../json-schema-typed" }
],
"include": ["src"],
"exclude": [
Expand Down
2 changes: 1 addition & 1 deletion packages/openapi/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,11 @@
"dependencies": {
"@orpc/client": "workspace:*",
"@orpc/contract": "workspace:*",
"@orpc/json-schema-typed": "workspace:*",
"@orpc/openapi-client": "workspace:*",
"@orpc/server": "workspace:*",
"@orpc/shared": "workspace:*",
"@orpc/standard-server": "workspace:*",
"json-schema-typed": "^8.0.1",
"rou3": "^0.7.3"
},
"devDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions packages/openapi/src/schema.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable no-restricted-imports */
import type { JSONSchema, keywords } from 'json-schema-typed/draft-2020-12'
import { ContentEncoding as JSONSchemaContentEncoding, Format as JSONSchemaFormat, TypeName as JSONSchemaTypeName } from 'json-schema-typed/draft-2020-12'
import type { JSONSchema, keywords } from '@orpc/json-schema-typed/draft-2020-12'
import { ContentEncoding as JSONSchemaContentEncoding, Format as JSONSchemaFormat, TypeName as JSONSchemaTypeName } from '@orpc/json-schema-typed/draft-2020-12'
Comment on lines +2 to +3

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

keywords wrongly imported with import type

typeof keywords relies on the value symbol, but import type erases it.
Compilation will fail with “only refers to a type, but is being used as a value”.

-import type { JSONSchema, keywords } from '@orpc/json-schema-typed/draft-2020-12'
+import { keywords } from '@orpc/json-schema-typed/draft-2020-12'
+import type { JSONSchema } from '@orpc/json-schema-typed/draft-2020-12'
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
import type { JSONSchema, keywords } from '@orpc/json-schema-typed/draft-2020-12'
import { ContentEncoding as JSONSchemaContentEncoding, Format as JSONSchemaFormat, TypeName as JSONSchemaTypeName } from '@orpc/json-schema-typed/draft-2020-12'
import { keywords } from '@orpc/json-schema-typed/draft-2020-12'
import type { JSONSchema } from '@orpc/json-schema-typed/draft-2020-12'
import { ContentEncoding as JSONSchemaContentEncoding, Format as JSONSchemaFormat, TypeName as JSONSchemaTypeName } from '@orpc/json-schema-typed/draft-2020-12'
🤖 Prompt for AI Agents
In packages/openapi/src/schema.ts at lines 2 to 3, the `keywords` import is
incorrectly imported using `import type`, which removes the value symbol needed
for `typeof keywords`. Change the import of `keywords` from `import type` to a
regular import so that both the type and value are available, preventing
compilation errors.


export { JSONSchemaContentEncoding, JSONSchemaFormat, JSONSchemaTypeName }
export type { JSONSchema }
Expand Down
1 change: 1 addition & 0 deletions packages/openapi/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
{ "path": "../contract" },
{ "path": "../server" },
{ "path": "../standard-server" },
{ "path": "../json-schema-typed" },
{ "path": "../shared" }
],
"include": ["src"],
Expand Down
18 changes: 12 additions & 6 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.