-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(types):
Jsonifiable
, JsonifiableArray
, JsonifiableObject
Signed-off-by: Lexus Drumgold <[email protected]>
- Loading branch information
1 parent
3d562a7
commit d3b4e43
Showing
5 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,7 @@ gpgsign | |
graphqlrc | ||
hmarr | ||
iife | ||
jsonifiable | ||
keyid | ||
larsgw | ||
lcov | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/** | ||
* @file Type Definitions - JsonifiableArray | ||
* @module tutils/types/JsonifiableArray | ||
*/ | ||
|
||
import type Jsonifiable from './jsonifiable' | ||
|
||
/** | ||
* Matches an array whose items can be losslessly converted to JSON. | ||
* | ||
* @see [`Jsonifiable`]({@link ./jsonifiable.ts}) | ||
*/ | ||
type JsonifiableArray = readonly Jsonifiable[] | ||
|
||
export type { JsonifiableArray as default } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/** | ||
* @file Type Definitions - JsonifiableObject | ||
* @module tutils/types/JsonifiableObject | ||
*/ | ||
|
||
import type Jsonifiable from './jsonifiable' | ||
|
||
/** | ||
* Matches an object whose items can be losslessly converted to JSON. | ||
* | ||
* @see [`Jsonifiable`]({@link ./jsonifiable.ts}) | ||
*/ | ||
type JsonifiableObject = | ||
| { [K in string]?: Jsonifiable } | ||
| { toJSON(): Jsonifiable } | ||
|
||
export type { JsonifiableObject as default } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/** | ||
* @file Type Definitions - Jsonifiable | ||
* @module tutils/types/Jsonifiable | ||
*/ | ||
|
||
import type JSONPrimitive from './json-primitive' | ||
import type JsonifiableArray from './jsonifiable-array' | ||
import type JsonifiableObject from './jsonifiable-object' | ||
|
||
/** | ||
* Matches a value that can be losslessly converted to JSON. | ||
* | ||
* Can be used to type values that are expected to pass `JSON.stringify`. | ||
*/ | ||
type Jsonifiable = JsonifiableArray | JsonifiableObject | JSONPrimitive | ||
|
||
export type { Jsonifiable as default } |