-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(TypeScript): add JsonCompatible type
More general than Object -- modern JSON serializers also support direct string, number, boolean, etc.
- Loading branch information
Showing
3 changed files
with
12 additions
and
1 deletion.
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
type JsonCompatible = | ||
| string | ||
| number | ||
| boolean | ||
| { [x: string]: JsonCompatible } | ||
| JsonCompatible[] | ||
|
||
export default JsonCompatible |
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 |
---|---|---|
@@ -1,5 +1,7 @@ | ||
import JsonCompatible from './JsonCompatible.js' | ||
|
||
interface JsonObject { | ||
data: Object | ||
data: JsonCompatible | ||
} | ||
|
||
export default JsonObject |
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