ItemConsulting / enonic-types

TypeScript types for Enonic XP
MIT License
8 stars 2 forks source link

Built-in content types #11

Closed edwardgronroos closed 3 years ago

edwardgronroos commented 3 years ago

What is your thought on adding types for XPs non-abstract built-in content types such as base:shortcut and base:folder.

We are encountering them in our code from time to time, and since they aren't generated by the gradle plugin we end up managing/duplicating them ourself, since they follow XP perhaps they could fit in here?

tajakobsen commented 3 years ago

Thanks for the suggestion @edwardgronroos . :+1:

I had a look at the shape of the built-in content types you suggested, and I created a new type for base:shortcut so that its shape can be represented like this: Content<BaseShortcut>. (This is found in the 0.1.19 release)

Correct me if I'm wrong but base:folder just has an empty object as its data attribute, so it can be adequately represented by a plain Content.

I also created a BaseMedia interface that can be used to represent most media types like this: Content<BaseMedia> (and we also already have Content<Image> from earlier).


@edwardgronroos Can you suggest any other types that makes sense implementing, that we don't already have?

edwardgronroos commented 3 years ago

Quick response and a release @tajakobsen 🙌

Not any more suggestions on types, but I have created a PR https://github.com/ItemConsulting/xp-codegen-plugin/pull/26 that I guess needs your approval.