@enonic-types/core
TypeScript icon, indicating that this package has built-in type declarations

7.14.4 • Public • Published

Enonic XP Core TS types

TypeScript definitions that are shared between libraries and represent core data structures.

Install

npm i --save-dev @enonic-types/core

Use

It is not necessary to include this dependency into your project, as all libraries export related core types, e.g. Content library exports Content type.

All core types can be imported using ES6-style import:

import type {Content} from '@enonic-types/core';

Content

Content contains the x property, that has a very special XpXData type.

XpXData is an interface, that is added to the global scope, so it can be modified using the declaration merging. This allows you to set the shape of the XData in your project, simply by declaring the XpXData like this:

declare global {
    interface XpXData {
        'com-mysite-app': {
            metadata: {
                metaTagTitle: string;
                metaTagImageId: string;
            }
        }
    }
}

Additional types

Content is a complex type that contains unions and maps, that are not exported, but may be needed during the development. Actually, these types can easily be retrieved from the Content itself:

import type {Content} from '@enonic-types/core';

type Attachments = Content['attachments'];

type ContentInheritType = Content['inherit'];

type Workflow = Content['workflow'];

Package Sidebar

Install

npm i @enonic-types/core

Weekly Downloads

1,460

Version

7.14.4

License

Apache-2.0

Unpacked Size

20 kB

Total Files

3

Last publish

Collaborators

  • edloidas
  • cwe_at_enonic.com
  • alansemenov