Donate. I desperately need donations to survive due to my health

Get paid by answering surveys Click here

Click here to donate

Remote/Work from Home jobs

how to pass hardcoding(static content) on typrescript interface with following code

I'm trying to pass Static content into NewsCarousel component this is PROPS of component

interface IProps {
    /** category of the news */
    title: string;
    /** an array of news articles to be rendered */
    articles?: NewsArticle.INewsArticle[];
    /** news category */
    category?: NewsGroup.INewsGroup;
    /** current cms control that will be rendered */
    control?: ICmsControl;
    /** If false, don't render the summary text, set via admin setting. */
    showSummary?: boolean;
    /** If news Feed is RSS news feed. */
    isRSS?: boolean;
}

News Article Interface can be use as in NewsCarousel component

export namespace NewsArticle {
    export const groupName = 'entities';
    export const itemKind = 'NewsDocument';

    export interface INewsArticle extends IStoreData {
        title: Value<string>;
        displayUrl: Value<string>;
        description: Value<string>;
        image: Value<string>;
        createdBy: Value<Profile.IProfile>;
        titleLink: Value<string>;
        openNewWindow: Value<boolean>;
        dateCreated: Value<DateTimeEx>;
        displayDate: Value<DateTimeEx>;
        feedType: Value<string>;
        newsBody: Value<string>;
        parentCategory?: Value<string>;
        folderDisplayUrl?: Value<string>;
        hash?: Value<string>;
        approved: Value<boolean>;
        permissionValue?: Value<number>;
    }

News Group Interface that can be use as in NewsCarousel component

export namespace NewsGroup {
    export const groupName = 'entities';
    export const itemKind = 'NewsGroup';

    export interface INewsGroup extends IStoreData {
        title: Value<string>;
        displayUrl: Value<string>;
        description: Value<string>;
        dateCreated: Value<DateTimeEx>;
        isRSS: Value<boolean>;
        active: Value<boolean>;
        isDefault: Value<boolean>;
        showMore: Value<boolean>;
        moreNewsText: Value<string>;
        showThumbnails: Value<boolean>;
        image: Value<string>;
        thumbnail: Value<string>;
        showSummary: Value<boolean>;
        showArchiveNews: Value<boolean>;
        subsiteEntityID: Value<string>;
        numOfNewsItems: Value<number>;
        children: ValueList<NewsArticle.INewsArticle>;
        rssChildren: ValueList<NewsArticle.INewsArticle>;
        permissionValue: Value<number>;
    }

I've tried way to pass it like below but didn't work, (ignore the extra const)

const date1 = new DateTimeEx('2016-10-01T15:05:00.000Z');
    const category = 'TECHNOLOGY';
    const imageUrl = 'https://lsdjlkasjd.com/wp-content/uploads/2016/12/1.png';
    const title = 'Headlines will look like this..';
    const url = '';
    const summary = 'Loreum ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor';
    const profileId = 'Someone';
    const itemKind = "entities"

<NewsCarousel
                    title={title}
                    category={'itemKind'}
                    title={userProvidedHeading.length ? userProvidedHeading : group.title.value}
                    showSummary={group.showSummary.value}
                    isRSS={isRss}
                />

I'm pretty not sure how to use/pass static content of Interface. Can anyone help me with this?

Comments