Skip to content

Commit

Permalink
Ban Map types in JSON related functions.
Browse files Browse the repository at this point in the history
In such reason, `typia` banned `Map` types on the JSON related functions. Following the policy of `typia`, `nestia` also bands such unsupported types on the JSON related functions.

> When `JSON.stringify()` function be called about `Map<Key, T>` type, it always returns the empty bracket value `{}`. Until now, I'd developed `typia` to return the empty bracket value `{}`, following the standard `JSON.stringify()` function.
>
> However, as most TypeScript/JavaScript developers do not know about that and there's not any problem when using the `Map` type on `typia.json.stringify<T>()` function ini the compile time, it was possible to misunderstand that `typia`'s stringify function has a bug about the `Map` time.
>
> In such reason, I've decided to throw a compile error when such non-supported type being used in the `typia.json` functions. Also, such strategy would be helpful for `typia` users to avoid taking a mistake using such non-supported type on the JSON functions.

- Related PR of `typia`: samchon/typia#844
  • Loading branch information
samchon committed Oct 12, 2023
1 parent 18dcb2c commit 66b56f4
Show file tree
Hide file tree
Showing 13 changed files with 28 additions and 28 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Check out the document in the [website](https://nestia.io/docs/):
- [TypedRoute](https://nestia.io/docs/core/TypedRoute/)
- [TypedBody](https://nestia.io/docs/core/TypedBody/)
- [TypedParam](https://nestia.io/docs/core/TypedParam/)
- [TypedQuery](https://nestia.io/docs/core/TypedRoute/)
- [TypedQuery](https://nestia.io/docs/core/TypedQuery/)
- [TypedHeaders](https://nestia.io/docs/core/TypedHeaders/)
- [TypedException](https://nestia.io/docs/core/TypedException/)
- Generators
Expand Down
4 changes: 2 additions & 2 deletions benchmark/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
},
"homepage": "https://nestia.io",
"dependencies": {
"@nestia/core": "^2.0.5-dev.20230921",
"typia": "^5.2.1"
"@nestia/core": "^2.2.1-dev.20231012",
"typia": "^5.2.2"
},
"devDependencies": {
"@trivago/prettier-plugin-sort-imports": "^4.1.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"@types/node": "^18.11.16",
"prettier": "^2.8.7",
"rimraf": "^3.0.2",
"typescript": "^5.2.1"
"typescript": "^5.2.2"
},
"files": [
"bin",
Expand Down
10 changes: 5 additions & 5 deletions packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nestia/core",
"version": "2.2.1",
"version": "2.2.2-dev.20231012",
"description": "Super-fast validation decorators of NestJS",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
Expand Down Expand Up @@ -34,7 +34,7 @@
},
"homepage": "https://nestia.io",
"dependencies": {
"@nestia/fetcher": "^2.2.1",
"@nestia/fetcher": "^2.2.2-dev.20231012",
"@nestjs/common": ">=7.0.1",
"@nestjs/core": ">=7.0.1",
"@nestjs/platform-express": ">=7.0.1",
Expand All @@ -44,10 +44,10 @@
"raw-body": ">=2.0.0",
"reflect-metadata": ">=0.1.12",
"rxjs": ">=6.0.0",
"typia": ">=5.2.1 <6.0.0"
"typia": ">=5.2.2 <6.0.0"
},
"peerDependencies": {
"@nestia/fetcher": ">=2.2.1",
"@nestia/fetcher": ">=2.2.2-dev.20231012",
"@nestjs/common": ">=7.0.1",
"@nestjs/core": ">=7.0.1",
"@nestjs/platform-express": ">=7.0.1",
Expand All @@ -56,7 +56,7 @@
"reflect-metadata": ">=0.1.12",
"rxjs": ">=6.0.0",
"typescript": ">=4.8.0",
"typia": ">=5.2.1 <6.0.0"
"typia": ">=5.2.2 <6.0.0"
},
"devDependencies": {
"@trivago/prettier-plugin-sort-imports": "^4.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"ts-node": "^10.9.1",
"ts-patch": "^3.0.2",
"typescript": "^5.2.2",
"typia": "^5.2.1"
"typia": "^5.2.2"
},
"dependencies": {
"chalk": "^4.1.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/fetcher/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nestia/fetcher",
"version": "2.2.1",
"version": "2.2.2-dev.20231012",
"description": "Fetcher library of Nestia SDK",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
Expand Down
4 changes: 2 additions & 2 deletions packages/fetcher/src/Primitive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
* `String` | `string`
* `Class` | `object`
* `Class` with `toJSON()` | `Primitive<ReturnType<Class.toJSON>>`
* Native Class | `{}`
* Native Class | never
* Others | No change
*
* @template Instance Target argument type.
Expand All @@ -49,7 +49,7 @@ type PrimitiveMain<Instance> = Instance extends [never]
: ValueOf<Instance> extends object
? Instance extends object
? Instance extends NativeClass
? {}
? never
: Instance extends IJsonable<infer Raw>
? ValueOf<Raw> extends object
? Raw extends object
Expand Down
2 changes: 1 addition & 1 deletion packages/migrate/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"typescript-transform-paths": "^3.4.6"
},
"dependencies": {
"typia": "^5.2.1"
"typia": "^5.2.2"
},
"files": [
"lib",
Expand Down
10 changes: 5 additions & 5 deletions packages/sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nestia/sdk",
"version": "2.2.1",
"version": "2.2.2-dev.20231012",
"description": "Nestia SDK and Swagger generator",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
Expand Down Expand Up @@ -35,7 +35,7 @@
},
"homepage": "https://nestia.io",
"dependencies": {
"@nestia/fetcher": "^2.2.1",
"@nestia/fetcher": "^2.2.2-dev.20231012",
"cli": "^1.0.1",
"glob": "^7.2.0",
"path-to-regexp": "^6.2.1",
Expand All @@ -44,16 +44,16 @@
"tsconfck": "^2.0.1",
"tsconfig-paths": "^4.1.1",
"tstl": "^2.5.13",
"typia": "^5.2.1"
"typia": "^5.2.2"
},
"peerDependencies": {
"@nestia/fetcher": ">=2.2.1",
"@nestia/fetcher": ">=2.2.2-dev.20231012",
"@nestjs/common": ">=7.0.1",
"@nestjs/core": ">=7.0.1",
"reflect-metadata": ">=0.1.12",
"ts-node": ">=10.6.0",
"typescript": ">=4.8.0",
"typia": ">=5.2.1 <6.0.0"
"typia": ">=5.2.2 <6.0.0"
},
"devDependencies": {
"@nestjs/common": ">= 7.0.1",
Expand Down
2 changes: 1 addition & 1 deletion test/features/distribute-assert/packages/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@
},
"dependencies": {
"@nestia/fetcher": "file:../../../../../packages/fetcher/nestia-fetcher-0.0.0-dev.20991231.tgz",
"typia": "^5.2.1"
"typia": "^5.2.2"
}
}
2 changes: 1 addition & 1 deletion test/features/distribute-json/packages/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@
},
"dependencies": {
"@nestia/fetcher": "file:../../../../../packages/fetcher/nestia-fetcher-0.0.0-dev.20991231.tgz",
"typia": "^5.2.1"
"typia": "^5.2.2"
}
}
2 changes: 1 addition & 1 deletion test/features/distribute/packages/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@
},
"dependencies": {
"@nestia/fetcher": "file:../../../../../packages/fetcher/nestia-fetcher-0.0.0-dev.20991231.tgz",
"typia": "^5.2.1"
"typia": "^5.2.2"
}
}
12 changes: 6 additions & 6 deletions test/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"private": true,
"name": "@nestia/test",
"version": "2.2.1",
"version": "2.2.2-dev.20231012",
"description": "Test program of Nestia",
"main": "index.js",
"scripts": {
Expand Down Expand Up @@ -32,14 +32,14 @@
"@types/uuid": "^9.0.0",
"ts-node": "^10.9.1",
"ts-patch": "v3.0.2",
"typescript": "^5.2.1",
"typescript": "^5.2.2",
"typescript-transform-paths": "^3.4.4",
"typia": "^5.2.1",
"typia": "^5.2.2",
"uuid": "^9.0.0",
"nestia": "^4.5.0",
"@nestia/core": "^2.2.1",
"@nestia/core": "^2.2.2-dev.20231012",
"@nestia/e2e": "^0.3.6",
"@nestia/fetcher": "^2.2.1",
"@nestia/sdk": "^2.2.1"
"@nestia/fetcher": "^2.2.2-dev.20231012",
"@nestia/sdk": "^2.2.2-dev.20231012"
}
}

0 comments on commit 66b56f4

Please sign in to comment.