UNPKG

siren-types

Version:

A bunch of Siren types defined in TypeScript plus some useful functions

20 lines (19 loc) 1.22 kB
import { Entity, SubEntity, Properties, EmbeddedLinkSubEntity, EmbeddedRepresentationSubEntity, EmbeddedRepresentationSubEntityWithoutProperties, EmbeddedRepresentationSubEntityWithProperties } from "./types"; /** Shorthand function */ export declare function isA(e: Entity<any>, className: string, ...additionalClasses: string[]): boolean; /** * Fetch (all) self relations. Only the href is included here because these * might come from a Link, EmbeddedLink or EmbeddedEntity (very unlikely). * @param s */ export declare function collectSelves(e: Entity<any>): string[]; /** * If you use this function in a conditional statement, the TypeScript compiler * will know to narrow the type of the argument based on the result. */ export declare function isEmbeddedLink<P extends Properties | undefined>(s: EmbeddedLinkSubEntity | EmbeddedRepresentationSubEntityWithoutProperties | EmbeddedRepresentationSubEntityWithProperties<P>): s is EmbeddedLinkSubEntity; /** * If you use this function in a conditional statement, the TypeScript compiler * will know to narrow the type of the argument based on the result. */ export declare function isEmbeddedRepr<P>(s: SubEntity<P>): s is EmbeddedRepresentationSubEntity<P>;