Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

enonic-types

Package Overview
Dependencies
Maintainers
1
Versions
179
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

enonic-types - npm Package Versions

13
18

0.5.0

Diff

Changelog

Source

0.5.0

New global maps are used for registering shapes of Content Types, as well as the shape of Site.config and Content.x.

Note If you are using xp-codegen-plugin@2.0.0 all the global declarations mentioned below are automatically generated for you based on the xml-files in your project! :tada:

ContentType map

The type system can now look up the content types when using contentLib.query() with the contentTypes parameter set.

For the type system to know about the shape of a content type, we first need to register it. This is done in a global declaration.

export type Article = import("./article").Article
export type Employee = import("./employee").Employee

declare global {
  namespace XP {
    interface ContentTypes {
      "com.mysite:article": Article;
      "com.mysite:employee": Employee;
    }
  }
}

This declaration only needs to be done once in your code base, and every XP.ContentTypes will now be merged to one interface.

tajakobsen
published 0.5.0-next.1 •

tajakobsen
published 0.4.11 •

tajakobsen
published 0.4.10 •

tajakobsen
published 0.5.0-next.0 •

tajakobsen
published 0.4.9 •

tajakobsen
published 0.4.8 •

tajakobsen
published 0.4.7 •

tajakobsen
published 0.4.6 •

tajakobsen
published 0.4.5 •

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc