-
-
Notifications
You must be signed in to change notification settings - Fork 163
Commit
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.
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import typia from "typia"; | ||
|
||
interface IPointer<T> { | ||
value: T; | ||
} | ||
|
||
// JSON SCHEMA | ||
typia.json.application<[Map<any, any>]>(); | ||
typia.json.application<[[Map<any, any>, Map<any, any>]]>(); | ||
typia.json.application<[Map<any, any>[]]>(); | ||
typia.json.application<[Record<string, Map<any, any>>]>(); | ||
typia.json.application<[IPointer<Map<any, any>>]>(); | ||
typia.json.application<[IPointer<[Map<any, any>, Map<any, any>]>]>(); | ||
typia.json.application<[IPointer<Map<any, any>[]>]>(); | ||
typia.json.application<[IPointer<Record<string, Map<any, any>>>]>(); | ||
|
||
// ENCODE | ||
typia.json.createStringify<Map<any, any>>(); | ||
typia.json.createStringify<[Map<any, any>, Map<any, any>]>(); | ||
typia.json.createStringify<Map<any, any>[]>(); | ||
typia.json.createStringify<Record<string, Map<any, any>>>(); | ||
typia.json.createStringify<IPointer<Map<any, any>>>(); | ||
typia.json.createStringify<IPointer<[Map<any, any>, Map<any, any>]>>(); | ||
typia.json.createStringify<IPointer<Map<any, any>[]>>(); | ||
typia.json.createStringify<IPointer<Record<string, Map<any, any>>>>(); | ||
|
||
// DECODE | ||
typia.json.createAssertParse<Map<any, any>>(); | ||
typia.json.createAssertParse<[Map<any, any>, Map<any, any>]>(); | ||
typia.json.createAssertParse<Map<any, any>[]>(); | ||
typia.json.createAssertParse<Record<string, Map<any, any>>>(); | ||
typia.json.createAssertParse<IPointer<Map<any, any>>>(); | ||
typia.json.createAssertParse<IPointer<[Map<any, any>, Map<any, any>]>>(); | ||
typia.json.createAssertParse<IPointer<Map<any, any>[]>>(); | ||
typia.json.createAssertParse<IPointer<Record<string, Map<any, any>>>>(); |
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import typia from "typia"; | ||
|
||
interface IPointer<T> { | ||
value: T; | ||
} | ||
|
||
// JSON SCHEMA | ||
typia.json.application<[Set<any>]>(); | ||
typia.json.application<[[Set<any>, Set<any>]]>(); | ||
typia.json.application<[Set<any>[]]>(); | ||
typia.json.application<[Record<string, Set<any>>]>(); | ||
typia.json.application<[IPointer<Set<any>>]>(); | ||
typia.json.application<[IPointer<[Set<any>, Set<any>]>]>(); | ||
typia.json.application<[IPointer<Set<any>[]>]>(); | ||
typia.json.application<[IPointer<Record<string, Set<any>>>]>(); | ||
|
||
// ENCODE | ||
typia.json.createStringify<Set<any>>(); | ||
typia.json.createStringify<[Set<any>, Set<any>]>(); | ||
typia.json.createStringify<Set<any>[]>(); | ||
typia.json.createStringify<Record<string, Set<any>>>(); | ||
typia.json.createStringify<IPointer<Set<any>>>(); | ||
typia.json.createStringify<IPointer<[Set<any>, Set<any>]>>(); | ||
typia.json.createStringify<IPointer<Set<any>[]>>(); | ||
typia.json.createStringify<IPointer<Record<string, Set<any>>>>(); | ||
|
||
// DECODE | ||
typia.json.createAssertParse<Set<any>>(); | ||
typia.json.createAssertParse<[Set<any>, Set<any>]>(); | ||
typia.json.createAssertParse<Set<any>[]>(); | ||
typia.json.createAssertParse<Record<string, Set<any>>>(); | ||
typia.json.createAssertParse<IPointer<Set<any>>>(); | ||
typia.json.createAssertParse<IPointer<[Set<any>, Set<any>]>>(); | ||
typia.json.createAssertParse<IPointer<Set<any>[]>>(); | ||
typia.json.createAssertParse<IPointer<Record<string, Set<any>>>>(); |
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.