-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rename fetch types and allow null payloads
- Loading branch information
1 parent
a8c4a24
commit 55d6e4c
Showing
5 changed files
with
29 additions
and
24 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
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,12 +1,12 @@ | ||
import {JsonObject} from './sdk/json'; | ||
import {NullableJsonObject} from './sdk/json'; | ||
|
||
export interface ContentMap { | ||
export interface SlotMap { | ||
} | ||
|
||
export type ContentId = keyof ContentMap extends never ? string : keyof ContentMap; | ||
export type SlotId = keyof SlotMap extends never ? string : keyof SlotMap; | ||
|
||
export type ContentPayload<I extends ContentId> = I extends keyof ContentMap ? ContentMap[I] : JsonObject; | ||
export type SlotContent<I extends SlotId> = I extends keyof SlotMap ? SlotMap[I] : NullableJsonObject; | ||
|
||
export type FetchResponse<I extends ContentId, P extends JsonObject = JsonObject> = { | ||
payload: ContentPayload<I> & P, | ||
export type FetchResponse<I extends SlotId, P extends NullableJsonObject = NullableJsonObject> = { | ||
payload: SlotContent<I> & P, | ||
}; |
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 |
---|---|---|
@@ -1 +1,4 @@ | ||
import {JsonObject} from '@croct/sdk/json'; | ||
|
||
export * from '@croct/sdk/json'; | ||
export type NullableJsonObject = JsonObject | null; |
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