Skip to content

Commit

Permalink
fix(types): add optional environment SpaceLink to Sys interface (#920)
Browse files Browse the repository at this point in the history
* fix(types): add optional environment SpaceLink to Sys interface

* fix(types): adjust link types and add EnvironmentLink

Co-authored-by: Janko Marklein <43542437+ruderngespra@users.noreply.github.com>
Co-authored-by: Janko Marklein <janko.marklein@contentful.com>
  • Loading branch information
3 people authored Oct 5, 2021
1 parent 01aec01 commit 78d77ec
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,23 +159,26 @@ export interface Sys {
space?: {
sys: SpaceLink;
};
environment?: {
sys: EnvironmentLink;
};
contentType: {
sys: ContentTypeLink;
};
}

export interface SpaceLink {
type: 'Link';
linkType: 'Space';
id: string;
}
export type LinkType = 'Space' | 'ContentType' | 'Environment'

export interface ContentTypeLink {
type: 'Link';
linkType: 'ContentType';
id: string;
export interface Link<T extends LinkType> {
type: 'Link'
linkType: T
id: string
}

export type SpaceLink = Link<'Space'>
export type EnvironmentLink = Link<'Environment'>
export type ContentTypeLink = Link<'ContentType'>

export interface Field {
disabled: boolean;
id: string;
Expand Down

0 comments on commit 78d77ec

Please sign in to comment.