@elliots/typical 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +51 -8
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Typical
|
|
2
2
|
|
|
3
|
-
Typical makes TypeScript type
|
|
3
|
+
Typical makes TypeScript type safe at runtime _with no changes to your code_.
|
|
4
4
|
|
|
5
5
|
It transforms your code to inject runtime validation based on your existing type annotations. With source maps, so errors point to the right lines in your original code.
|
|
6
6
|
|
|
@@ -38,13 +38,14 @@ const user = JSON.parse('{"name":"Alice","email":"not-an-email"}') as User;
|
|
|
38
38
|
|
|
39
39
|
Choose the integration that fits your workflow:
|
|
40
40
|
|
|
41
|
-
| Method | Best For | Package
|
|
42
|
-
| --------------------------------------------------------- | ------------------------------- |
|
|
43
|
-
| [ESM Loader](#nodejs-esm-loader) | Node.js scripts, development | `@elliots/typical`
|
|
44
|
-
| [ttsx](#ttsx-tsx-wrapper) | Quick scripts with tsx | `@elliots/typical` + `tsx`
|
|
45
|
-
| [Bun Plugin](#bun) | Bun projects | `@elliots/bun-plugin-typical`
|
|
46
|
-
| [
|
|
47
|
-
| [
|
|
41
|
+
| Method | Best For | Package |
|
|
42
|
+
| --------------------------------------------------------- | ------------------------------- | ------------------------------------ |
|
|
43
|
+
| [ESM Loader](#nodejs-esm-loader) | Node.js scripts, development | `@elliots/typical` |
|
|
44
|
+
| [ttsx](#ttsx-tsx-wrapper) | Quick scripts with tsx | `@elliots/typical` + `tsx` |
|
|
45
|
+
| [Bun Plugin](#bun) | Bun projects | `@elliots/bun-plugin-typical` |
|
|
46
|
+
| [React Native / Expo](#react-native--expo) | React Native apps | `@elliots/metro-transformer-typical` |
|
|
47
|
+
| [Vite/Webpack/etc](#bundlers-vite-webpack-rollup-esbuild) | Frontend apps, bundled projects | `@elliots/unplugin-typical` |
|
|
48
|
+
| [tsc Plugin](#typescript-compiler-tsc) | Pure TypeScript compilation | `@elliots/typical-tsc-plugin` |
|
|
48
49
|
|
|
49
50
|
---
|
|
50
51
|
|
|
@@ -123,6 +124,44 @@ bun run src/index.ts
|
|
|
123
124
|
|
|
124
125
|
---
|
|
125
126
|
|
|
127
|
+
## React Native / Expo
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
npm add @elliots/metro-transformer-typical
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
Update your `metro.config.js`:
|
|
134
|
+
|
|
135
|
+
```js
|
|
136
|
+
// metro.config.js
|
|
137
|
+
const { getDefaultConfig } = require("expo/metro-config");
|
|
138
|
+
const { withTypical } = require("@elliots/metro-transformer-typical");
|
|
139
|
+
|
|
140
|
+
module.exports = withTypical(getDefaultConfig(__dirname));
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
For vanilla React Native (without Expo):
|
|
144
|
+
|
|
145
|
+
```js
|
|
146
|
+
// metro.config.js
|
|
147
|
+
const { getDefaultConfig } = require("@react-native/metro-config");
|
|
148
|
+
const { withTypical } = require("@elliots/metro-transformer-typical");
|
|
149
|
+
|
|
150
|
+
module.exports = withTypical(getDefaultConfig(__dirname));
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
With options:
|
|
154
|
+
|
|
155
|
+
```js
|
|
156
|
+
module.exports = withTypical(getDefaultConfig(__dirname), {
|
|
157
|
+
typical: {
|
|
158
|
+
validateCasts: true,
|
|
159
|
+
},
|
|
160
|
+
});
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
---
|
|
164
|
+
|
|
126
165
|
## Bundlers (Vite, Webpack, Rollup, esbuild)
|
|
127
166
|
|
|
128
167
|
```bash
|
|
@@ -489,6 +528,10 @@ Runtime validation performance comparing Typical vs Zod vs no validation:
|
|
|
489
528
|
|
|
490
529
|
<!-- CHANGELOG_START -->
|
|
491
530
|
|
|
531
|
+
### v0.3.1 (2026-02-23)
|
|
532
|
+
|
|
533
|
+
Add metro transformer (React Native/Expo)
|
|
534
|
+
|
|
492
535
|
### v0.3.0 (2026-01-14)
|
|
493
536
|
|
|
494
537
|
- Build call graph across whole project to avoid validating already-validated data
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliots/typical",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Runtime safe TypeScript transformer using typia",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"runtime",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"commander": "14.0.2",
|
|
43
|
-
"@elliots/typical-compiler": "0.3.
|
|
43
|
+
"@elliots/typical-compiler": "0.3.1"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@types/node": "22",
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
"build:ts": "pnpm --filter './packages/*' run build && tsc",
|
|
76
76
|
"build:website": "pnpm --filter typical-website run build",
|
|
77
77
|
"dev": "tsc --watch",
|
|
78
|
-
"test": "rm -f test/test.temp.ts && tsc && node --import ./dist/src/esm-loader-register.js --test dist/test/*.test.js",
|
|
78
|
+
"test": "rm -f test/test.temp.ts && rm -rf test/project-fixtures && tsc && node --import ./dist/src/esm-loader-register.js --test dist/test/*.test.js",
|
|
79
79
|
"test:coverage": "rm -f test/test.temp.ts && tsc && node --import ./dist/src/esm-loader-register.js --test --experimental-test-coverage dist/test/*.test.js",
|
|
80
80
|
"test:coverage:html": "rm -f test/test.temp.ts && tsc && c8 --reporter=html --reporter=text --include='dist/src/**' node --import ./dist/src/esm-loader-register.js --test dist/test/*.test.js",
|
|
81
81
|
"bench": "pnpm run build && cd bench && pnpm install && npm run bench",
|
|
@@ -86,6 +86,7 @@
|
|
|
86
86
|
"sample:ttsc": "cd samples/ttsc && pnpm install && npm run build && npm run start",
|
|
87
87
|
"sample:vite-react": "cd samples/vite-react && pnpm install && pnpm run test",
|
|
88
88
|
"sample:bun": "cd samples/bun && pnpm install && bun run start",
|
|
89
|
+
"sample:react-native": "cd samples/react-native && pnpm install && npm run web",
|
|
89
90
|
"samples": "npm run sample:esm && npm run sample:ttsx && npm run sample:vite-react && npm run sample:bun",
|
|
90
91
|
"publish:all": "npm run lint && npm run format:check && node scripts/publish.js"
|
|
91
92
|
}
|