@enonic-types/core v7.14.0
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'];
4 months ago
4 months ago
4 months ago
4 months ago
5 months ago
5 months ago
8 months ago
6 months ago
10 months ago
9 months ago
10 months ago
11 months ago
11 months ago
11 months ago
11 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago